linkage in C and C++

Nice articles on linkage under c and c++ on embedded:
Embedded.com – Linkage in C and C++
Embedded.com – Storage class specifiers and storage duration
Embedded.com – Scope regions in C and C++

These articles describe the various storage specifier, static, extern for functions and objects.

This topic is not as regularly discussed as RAII or exceptions, but IMHO it is an important one and should be known to any C/C++ programmer.

Oh yeah, and remember that anonymous namespaces in C++ give you the same behavior as using the static keyword but with external linkage: names are unique to the compilation unit they are in but they use external linkage – not internal.
Why ? So symbols used in the anonymous namespaces can be used with templates: templates parameters must have external linkage.

Advertisements

About this entry