[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: odd compiler behaviour?



On Sun, Mar 16, 2003 at 10:17:52AM -0800, Eric G. Miller wrote:
> On Sun, Mar 16, 2003 at 12:40:52PM +0000, Colin Watson wrote:
> > On Sun, Mar 16, 2003 at 04:56:53PM +1100, Rob Weir wrote:
> > > On Fri, Mar 14, 2003 at 04:00:22PM +0000, Bruynooghe Floris wrote:
> > > > int main()
> > > 
> > > An addition to what everyone else said, this really should be 
> > > 
> > > int main(int argc, char** argv)
> > > 
> > > to truly satisfy the pedant within :)
> > 
> > Doesn't matter if you aren't using them. '()' in C means "unspecified
> > arguments", as opposed to "no arguments" which is '(void)'.
> 
> In a definition, () and (void) are identical. It's only in the
> declaration where () means a fixed but unspecified number of arguments
> and only crazy people write declarations for "main".

I stand corrected, then. Although 'info libc' does say that (void) is OK
for main() in ISO C.

-- 
Colin Watson                                  [cjwatson@flatline.org.uk]



Reply to: