Hi all,
Working with g++ 3.* I have to include 3rd
party C-headers which tend to use the same
name for typedefs and
variables
e.g:
<snip>
/* test.h
*/
typedef int bar;
struct foo {
bar bar;
};
</snip>
....which seems to be valid C-code. When I include
these with:
<snip>
extern "C" {
#include <test.h>
};
</snip>
g++ chokes on these identical IDs.
I help myself with including
#ifdef __cplusplus
typedef int bar_t;
struct foo {
bar_t bar;
};
#else
typedef int bar;
struct foo {
bar bar;
};
#endif
...which is cumbersome and ugly.
1. Is this behavior part of the standard or a defect
of GNU C++ ?
2. Is there a more elegant (may be even portable) way
to compile these C-headers without having to change
them.
Thanks you for your attention
O.
--
[ See http://www.gotw.ca/resources/clcm.htm
for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]