On 21 January 2018 at 12:08, Georg-Johann Lay wrote: > 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
That's a different case. There's no advantage to the 'extern' here, because the code means the same thing in C and C++ without the 'extern', so just leave it out.