bison-patches
[Top][All Lists]
Advanced

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

Re: RFC: maint: c++: use nullptr for C++11


From: Akim Demaille
Subject: Re: RFC: maint: c++: use nullptr for C++11
Date: Sat, 31 Mar 2012 11:20:05 +0200

Hi Paul,

Le 30 mars 2012 à 20:15, Paul Eggert a écrit :

> On 03/30/2012 07:38 AM, Akim Demaille wrote:
> 
>> I am explicitly expecting NULL to be defined for C
> 
> That's not a portable assumption, since NULL is defined in
> include files like <stddef.h>, and the C parsers try to avoid
> including <stddef.h> etc. in order to keep the name-space as
> clean as possible.  At least, yacc.c does that; I didn't check
> the others.
> 
> Instead, I suggest using the same definition for YY_NULL in
> C as in C++, namely this one:
> 
>   # ifndef YY_NULL
>   #  if 201103L <= __cplusplus
>   #   define YY_NULL nullptr
>   #  else
>   #   define YY_NULL 0
>   #  endif
>   # endif

Thanks!  I have done that in the patch I installed in maint
(attached).  There is one issue to cover: G++ will happily
complain about 0 instead of nullptr even when it does not
declare it is C++11 via __cplusplus.  I will change configure.ac
to use the corresponding warning only when the compiler does
conform to the standard value of __cplusplus.

Attachment: 0001-c-use-nullptr-for-C-11.patch
Description: Binary data


reply via email to

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