Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!mcvax!diku!olamb!kimcm From: kimcm@olamb.UUCP (Kim Chr. Madsen) Newsgroups: comp.lang.c Subject: Re: "exit 0;" - or - "exit (0);" ? Message-ID: <144@olamb.UUCP> Date: Mon, 24-Nov-86 11:15:37 EST Article-I.D.: olamb.144 Posted: Mon Nov 24 11:15:37 1986 Date-Received: Tue, 25-Nov-86 20:59:46 EST References: <1512@batcomputer.tn.cornell.edu> Distribution: net Organization: AmbraSoft A/S (Denmark) Lines: 30 In article <1512@batcomputer.tn.cornell.edu>, braner@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.