How to avoid namespace collision in C and C++
I can use using namespace directive to avoid identifier/variable name
collision, but what happens when file names or library names collision
happens in large projects.
In C the conventional approach is to add files recursively using
#include_next directive. How can I achieve the same in C++ without using
the #include_next directive and address the issue of duplicate file names
among applications and shared libraries. An example, a work around the
class() function in AIX math.h clashing with identifiers named "class".
/* GNU Lesser GPLv2.1 or later */
#ifndef FFMPEG_COMPAT_AIX_MATH_H
#define FFMPEG_COMPAT_AIX_MATH_H
#define class class_in_math_h_causes_problems
#include_next <math.h>
#undef class
No comments:
Post a Comment