"exit 0;" - or - "exit (0);" ?

Kim Chr. Madsen kimcm at olamb.UUCP
Tue Nov 25 02:15:37 AEST 1986


In article <1512 at batcomputer.tn.cornell.edu>, braner at batcomputer.tn.cornell.edu (braner) writes:
> []
> 
> While K&R explicitly say that exit() is a function, I commonly see
> the parens dropped.  Is that "legal"? Does it work on existing compilers?
> And while I am asking:  how's "if (foo) {...}" vs. "if foo {...}" ?
> (in the case where "foo" is a variable, say an int used as a flag.)
> 
> - Moshe Braner, Cornell Univ.

WHY ?

If your C-compiler (or someone else's) have the feature to make these non-standard
features - DON'T USE THEM - DON'T RELY ON THEM....

If you use all these nasty little undocumented features a specific programming
language, operating system, ...etc... has you're getting yourself into troubles!

	1) Your code will be hard to understand by others (and yourself after
	   some time)
	2) Your code is NON-STANDARD!!!
	3) Your code will be non-portable between machines/compilers.
	4) The next release of the compiler have no obligation to follow
	   previous non-documented features. So your fine 10,000 lines
	   program will not compile (in best case, worst case it will compile
	   but yields unpredictable results).

SO - stick to the standard and what is approved to be portable/documented.

						<Kim Chr. Madsen>



More information about the Comp.lang.c mailing list