This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: -Wzero-as-null-pointer-constant & extern "C" blocks
- From: Daniel Llorens <daniel dot llorens at bluewin dot ch>
- To: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- Cc: gcc-help <gcc-help at gcc dot gnu dot org>
- Date: Mon, 13 Oct 2014 14:27:24 +0200
- Subject: Re: -Wzero-as-null-pointer-constant & extern "C" blocks
- Authentication-results: sourceware.org; auth=none
- References: <9A581557-C983-448B-A4C2-70AE229442E8 at bluewin dot ch> <CAH6eHdQCcBSNt4_+fxF5XZVLbutqO++wLgMaXGbkS3rj7wwjjw at mail dot gmail dot com>
On 13 Oct 2014, at 14:02, Jonathan Wakely <jwakely.gcc@gmail.com> wrote:
> On 13 October 2014 12:57, Daniel Llorens wrote:
>> I tried using -Wzero-as-null-pointer-constant in a C++ program, but I got warnings in some C headers, even though they are wrapped in extern "C" blocks.
>>
>> Since there is no nullptr in C, wouldn't it make more sense to disable the warning within those blocks? Is there some option that I'm missing?
>
> Although it's usually used in headers that need to be valid in both C
> and C++, extern "C" does not mean you can't use C++ features.
>
> extern "C" {
> void* ptr = nullptr;
> }
Makes sense, thanks.