While I'm in the mood to complain about the inadequacies of C ...

Add a semi-colon to the end of a function definition and watch the V5 C compiler lose the plot. How could this happen? Easily if you define the prototype e.g.,

int doStuff( int session,
char * path,
... );

and then use copy-and-paste to define the function itself e.g.,

int doStuff( int session,
char * path,
... );
{
/* Code body goes here */
}

Why is this a problem? Because the V5 (AIX code-base) C compiler does not recognise the syntax error and blithely continues processing until some internal limit is reached whereupon it finally signals a Syntax error miles (in my case 4437 lines) away from the source of the problem. Remarkably difficult to catch after the fact.

I resolved it by running the source through the V4 (native) C compiler which does catch this error (and quite a few others that confuse the V5 compiler.

I used to tell C programmers who came to OS/400 that they could dispense with the standard practice of fixing only the first compiler error because the OS/400 C compiler was good enough to reset after an error (and certainly after the end of a function was reached) so they could examine and correct multiple compiler errors in the same edit session. Looks like that is no longer true. The V5 compiler is much more easily confused than the the V4 (and earlier) compilers.

Regards,
Simon Coulter.
--------------------------------------------------------------------
FlyByNight Software OS/400, i5/OS Technical Specialists

http://www.flybynight.com.au/
Phone: +61 2 6657 8251 Mobile: +61 0411 091 400 /"\
Fax: +61 2 6657 8251 \ /
X
ASCII Ribbon campaign against HTML E-Mail / \
--------------------------------------------------------------------




This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available here. If you have questions about this, please contact [javascript protected email address].