prototype my function, please

King Claudius cknight at polyslo.CalPoly.EDU
Mon Jun 11 07:46:35 AEST 1990



karl at haddock.ima.isc.com (Karl Heuer) writes:
?steve at taumet.UUCP (Stephen Clamage) writes:
?>[Given `int main(void) { ... exit(0); }'] It seems some compilers [would
?>complain if a `return' were added], and some about absence of return [on an
?>int function].  What to do?  What to do?
?
?My opinion: leave it out, and if the compiler doesn't provide a way to
?suppress the warning, then complain to the vendor.  Since it is very common to
?leave main() with exit(), and since this is a defensible programming style,
?the compiler should allow it--even if it has to make main() a special case.

An easier way to do this is to declare main as returning void...

void main (void) {...}

-- 
cknight at polyslo.calpoly.edu                    ---King Claudius---



More information about the Comp.lang.c mailing list