C
Christopher Pisz
I normally never define a global in a header file, but some preexisting
code I am working on does the following:
-------
//a.h
// Someone wrote a comment that this header must be C compilable
// I assume MSVC defines this
#ifdef __cplusplus
static const long someGlobal1 = 100;
static const long someGlobal2 = 100;
// etc.
#else
#define someGlobal1 (100);
#define someGlobal2 (157);
//etc.
#endif
-------
//b.h
#include "a.h"
class MyClass
{
public:
// Snip
private
SomeType[someGlobal] m_anArray;
};
code I am working on does the following:
-------
//a.h
// Someone wrote a comment that this header must be C compilable
// I assume MSVC defines this
#ifdef __cplusplus
static const long someGlobal1 = 100;
static const long someGlobal2 = 100;
// etc.
#else
#define someGlobal1 (100);
#define someGlobal2 (157);
//etc.
#endif
-------
//b.h
#include "a.h"
class MyClass
{
public:
// Snip
private
SomeType[someGlobal] m_anArray;
};