www.digitalmars.com         C & C++   DMDScript  

c++.dos - Preprocessor bug?

reply "Gisle Vanem" <giva bgnett.no> writes:
The following code snippet fails and causes an internal error in dmc v8.28n:

#include <stdio.h>
#define CONCAT(x,y)   x##y
#define NAMESPACE(x)  CONCAT(w32,x)
#define foo NAMESPACE(foo)

int foo (void) { }

int main (void)
{
  foo();
  return (0);
}

--------------------------------------------------
c:\net\watt\src>dmc -c test.c
int foo (void)
      ^
test.c(9) : Preprocessor error: unterminated macro argument
Fatal error: out of memory
--- errorlevel 1

--------------------------------------------------

If I do "#define NAMESPACE(x) w32 ## x", it compiles fine.

Gisle V.
Jul 01 2002
parent "Walter" <walter digitalmars.com> writes:
Thanks! I'll check it out.
Jul 01 2002