extern const initialized warns in C
Franz Sirl
Franz.Sirl-kernel@lauterbach.com
Mon Jan 22 09:44:00 GMT 2018
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
More information about the Gcc
mailing list