[LAD] G++ trouble

Uwe Koloska lad at koloro.de
Tue Nov 17 17:51:20 CET 2020


Am 17.11.20 um 10:59 schrieb Fons Adriaensen:
> But it doesn't make sense to me.

Yes, we are in the same boat here.

> I've always understood 'extern' has
> 'defined somewhere but not here'. In other words 'extern' must be
> part of a declaration, and not of a definition as that would be
> a contradiction in terms.

I finally have found something in the C++11 standard. But only in
appendix C that lists the differences to ISO C. There is a rationale,
but I don't get why this is more important than consistency ...

http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2011/n3242.pdf

 * Change :: A name of file scope that is explicitly declared =const=,
   and not explicitly declared =extern=, has internal linkage, while in
   C it would have external linkage
 * Rationale :: Because =const= objects can be used as compile-time
   values in C++, this feature urges programmers to provide explicit
   initializer values for each =const=. This feature allows the user to
   put =const= objects in header files that are included in many
   compilation units.
 * Effect on original feature :: Change to semantics of well-defined
   feature.
 * Difficulty of converting :: Semantic transformation
 * How widely used :: Seldom

Uwe


More information about the Linux-audio-dev mailing list