typedef-ing an array

Karl Heuer karl at haddock.ima.isc.com
Wed Jul 4 05:01:53 AEST 1990


In article <12433 at sun.udel.edu> toor at sun.udel.edu (Kartik S Subbarao) writes:
>In article <25247 at mimsy.umd.edu> chris at mimsy.umd.edu (Chris Torek) writes:
>>The first error is `void main': it must (yes must) be `int main', even
>>if it never returns.  It may have either 0 arguments or two (int argc,
>>char *argv).
>
>(yes must)??!?!?!?!?! I beg to differ.
>[Sample code elided]

No, Chris was right (except that he forgot the second star in `char **argv').
Many compilers accept buggy code and even produce the intended answer, but
that doesn't make it right.  Not even if most compilers do it.

>So you CAN have a) void main if you desire,
>		b) only one argument to main.

In the most common implementation, both of these happen to work.  Neither is
Standard-conforming.  Both are likely to be caught by some future compiler.

Karl W. Z. Heuer (karl at kelp.ima.isc.com or ima!kelp!karl), The Walking Lint



More information about the Comp.lang.c mailing list