Tips and tricks

Using namespaces

You may encounter the following namespace issues for C and C++ applications:

  • Some standard C++ libraries include a bug where types defined by the library are imported into the global namespace. This can make porting really difficult if you try to link against a standard library implementation, such as Dinkum (the default for the Native SDK), which doesn’t have that bug.
  • Including a C++ library header may promote external names declared in the std namespace into the global namespace as well, with individual using declarations for each name.
  • In some environments, the C standard headers include no namespace declarations, declaring all names directly in the global namespace. This is in violation of the C++ standard.

Using older code

There are some older variants of C++ code out there, so you can choose to switch the runtime to C++ Dinkum (which the Native SDK uses) or use the compiler switch -Y_gpp to tell the compiler that the application is non-conformant.