[Top][All Lists]

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

Re: [PATCH] AC_LANG_INT_SAVE: Modernize function declarators (C89 and ab

From: Vincent Lefevre
Subject: Re: [PATCH] AC_LANG_INT_SAVE: Modernize function declarators (C89 and above).
Date: Sat, 8 Aug 2020 02:57:30 +0200
User-agent: Mutt/1.14.5+76 (bb407ec3) vl-127292 (2020-06-24)

On 2020-08-07 16:44:16 -0700, Paul Eggert wrote:
> On 8/7/20 1:01 PM, Vincent Lefevre wrote:
> > The program
> > 
> > int main(void)
> > {
> >    return 0;
> > }
> > 
> > compiles fine with g++, even using "-std=c++17 -pedantic".
> I expect the problem was with non-GNU C++ compilers, not with g++. However,
> I'm not the C++ guy so I'm the wrong person to ask about the details. You
> could write to Bruno Haible - I think he was the one preferring 'int main ()
> ...'.

all say that both constructs are equivalent in C++. Thus
"int main(void)" is valid in C++.

WP says that the form without "void" is preferred, but does not say
why. I suppose that this is only for C++ programs (i.e. which can't
be compiled with a C compiler), in which case both constructs are
necessarily equivalent, and the form without void is more "logic".

Vincent Lefèvre <> - Web: <>
100% accessible validated (X)HTML - Blog: <>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

reply via email to

[Prev in Thread] Current Thread [Next in Thread]