C
CBFalconer
Additions welcome. Without further ado, I present.
/* ---------- worst.c -----------*/
/* The objective here is to include as many C errors as
possible, without triggering the compiler into objecting.
I have tried to get an error into each line. Logical
foulups count. The test compiler is gcc 3.2.1, executed
with "gcc worst.c", i.e. with absolutely no extra warning
enabled, and linking successfully.
I have tried for at least one error per line. However
some variable declarations remain completely valid */
#define EOF -1
#define stdin 0
main()
{
int x, y;
char c;
char *fmt = "%d, %l";
unsigned int z;
while (!feof()) {
c = getchar();
if (EOF == c) continue;
}
gets(&c);
printf(fmt, &c, x);
fflush(stdin);
fmt = (char *)malloc(123);
fmt = (char *)realloc(fmt, 245);
y = fmt[1000];
for (z = 10; z >=0; z--) x += z;
if (z > 0) return -1;
} /* worst main */
/* ---------- worst.c -----------*/
/* The objective here is to include as many C errors as
possible, without triggering the compiler into objecting.
I have tried to get an error into each line. Logical
foulups count. The test compiler is gcc 3.2.1, executed
with "gcc worst.c", i.e. with absolutely no extra warning
enabled, and linking successfully.
I have tried for at least one error per line. However
some variable declarations remain completely valid */
#define EOF -1
#define stdin 0
main()
{
int x, y;
char c;
char *fmt = "%d, %l";
unsigned int z;
while (!feof()) {
c = getchar();
if (EOF == c) continue;
}
gets(&c);
printf(fmt, &c, x);
fflush(stdin);
fmt = (char *)malloc(123);
fmt = (char *)realloc(fmt, 245);
y = fmt[1000];
for (z = 10; z >=0; z--) x += z;
if (z > 0) return -1;
} /* worst main */