Re: Simplicity has a future



Richard Heathfield wrote:
Ian Collins said:


Richard Heathfield wrote:

Ian Collins said:


My C compiler gave several screens of errors and warning before giving
up.


Try it again, fixing the trivial error on line 20


Don't bother - it isn't an error.


One good reason for passing C though a C++ compiler:

"/tmp/x.c", line 16: Error: Cannot use const char[82] to initialize
char[81].


Oh yes you can. Not in C++, true - but this is comp.lang.c, not
comp.lang.c++, and the code I posted is C, not C++.

Read the code more carefully. I think you jumped to a false conclusion.

OK, it may be legal C, but it ain't pretty.

#include <stdio.h>

int main(void)
{
char title__of__the__program[81] =
"C to C++ Translation\nONLY extra casts and renaming"
" of variables are allowed.\n\n\n\n\n";

printf( "%s\n", title__of__the__program );

return 0;
}

I'd rather have the compiler barf.

--
Ian Collins.
.