Re: Offline Tutorial
- From: richard@xxxxxxxxxxxxxxx (Richard Tobin)
- Date: 17 May 2007 22:22:18 GMT
In article <1179438839.909509.196060@xxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Tejas Kokje <binarysemaphore@xxxxxxxxx> wrote:
Ok.that may be for C89 or K & R C. But can somebody show me a C99
program which won't compile under C++ compiler ? I am just curious.
int main(void)
{
char *namespace = "http://example.org";
return 0;
}
"namespace" is a keyword in C++.
I have written C code which turned out to have this problem, and
"namespace" was used as a struct tag in a header, which made
it impossible to link with C++. The code was already in use, so
I didn't want to change the name. I ended up doing this:
#ifdef __cplusplus
/* unfortunately the word "namespace" is reserved in C++ */
#define RXP_NAMESPACE name_space
#else
#define RXP_NAMESPACE namespace
#endif
and referring to RXP_NAMESPACE throughout the header.
-- Richard
--
"Consideration shall be given to the need for as many as 32 characters
in some alphabets" - X3.4, 1963.
.
- References:
- Offline Tutorial
- From: Zabac
- Re: Offline Tutorial
- From: Tejas Kokje
- Re: Offline Tutorial
- From: Flash Gordon
- Re: Offline Tutorial
- From: Tejas Kokje
- Offline Tutorial
- Prev by Date: Re: reborn ?
- Next by Date: Re: reborn ?
- Previous by thread: Re: Offline Tutorial
- Next by thread: Re: Offline Tutorial
- Index(es):
Relevant Pages
|