>>45
indent is an old and unmaintained codebase that is most definitely showing its age, and I'm not sure why you would even feel the inclination to argue otherwise, except maybe
IHBT, but here's some
perfectly valid C99 code that it completely fucks up:
#include <stdio.h>
struct label {
int x, y;
const char *s;
};
struct label labels[] = { {
.x = 1,
.y = 2,
.s = "Abort",
}, {
.x = 3,
.y = 4,
.s = "Retry",
}, {
.x = 5,
.y = 6,
.s = "Ignore",
}, {
.x = 7,
.y = 8,
.s = "Why does indent break this so badly?",
} }, another_label = {
.x = 9,
.y = 10,
.s = "and it gives up entirely here",
};
void dumplabels(int n, struct label *args) {
for (int a = 0; a < n; a++)
printf("%d, %d: %s\n", args[a].x, args[a].y, args[a].s);
}
// slightly contrived, but really NOT much of a stretch from useful code.
int main(int argc, char **argv) {
for (int a = 10, b = 0; b < 10; b++, a--)
// indent crams this all together... more like obfuscate
dumplabels(3, ((struct label[]) {
{
.x = a,
.y = b,
.s = "a and b",
}, {
.s = "no x/y given",
}, {
.y = a,
.s = "y is a",
},
}));
return 0;
}
astyle is marginally better here, but some of its styles botch the indentation fairly completely as well.