I created a C header for the C ++ static library foo.h, which looks like this:
#ifndef __FOO_H__
#define __FOO_H__
const size_t SOME_CONST = 22;
#ifdef __cplusplus
extern "C" {
#endif
unsigned long foo();
...
void bar();
#ifdef __cplusplus
}
#endif
#endif
I wanted to put it in some namespace in a different header cfoo. I wrote this:
#ifndef __CFOO__
#define __CFOO__
namespace foo {
#include "foo.h"
}
#endif
GCC shows no errors, and as I test everything looks fine, but I'm still not sure if this is the correct way to create this namespace. Can anyone confirm that this is a good way to do this, or maybe there are some suggestions to make it better?
source
share