[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] tests: avoid c++ failure due to lack of getenv decl
From: |
Jim Meyering |
Subject: |
Re: [PATCH] tests: avoid c++ failure due to lack of getenv decl |
Date: |
Thu, 16 Feb 2012 12:50:08 +0100 |
Akim Demaille wrote:
> Le 16 févr. 2012 à 11:11, Jim Meyering a écrit :
>
>> I noticed that there was a single test failure when
>> running "make check" using the latest gcc/g++ from git (4.7.x).
>>
>> Pushed to master, as obvious:
>
> Thanks!
>
>> %code
>> {
>> + #include <stdlib.h>
>
> FWIW, the proper way to include standard C headers
> in C++ is without .h, and a prepended "c". So that would be
> #include <cstdlib>.
Thanks. I'll adjust. (not so obvious after all, eh?)
>> int yylex (yy::parser::semantic_type *);
>> }
>>
>> @@ -510,7 +511,7 @@ yy::parser::error (const std::string &m)
>> }
>>
>> int
>> -main ()
>> +main (void)
>
> C++ forbids functions which are not prototyped, so
> void is useless here, and () cannot mean "I did not
> specify the argument types". So it's rather more
> common not to use void for incoming arguments than
> specifying it.
Either way is fine.
I was just making it consistent with the "main (void)"
in the preceding test. Would you prefer to omit both?