[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc
Subject:    Re: extern const initialized warns in C
From:       Franz Sirl <Franz.Sirl-kernel () lauterbach ! com>
Date:       2018-01-22 9:44:29
Message-ID: b662d086-7f34-4edd-b2c5-4f0eda542395 () lauterbach ! com
[Download RAW message or body]

Am 2018-01-21 um 13:08 schrieb Georg-Johann Lay:
> Jay K schrieb:
>> extern const int foo = 123;
>>
>> Why does this warn?
>> This is a valid portable form, with the same meaning
>> across all compilers, and, importantly, portably
>> to C and C++.
> 
> I also wondered about this.
> 
> In C99  §6.9.2 "External object definitions" there's actually
> the following example in clause 4:
> 
> extern int i3 = 3; // definition, external linkage

See https://gcc.gnu.org/ml/gcc-patches/2018-01/msg01848.html for a patch 
to make it controllable, though I wrote it for the opposite reason, 
namely to be able to turn it into an error separately (and to sync with 
the clang option).

Franz
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic