1

I'm working in C# via MonoDevelop 4.0.1 (Current version for Unity), and have hit a seeming language weirdness.

Here's my entire .cs file:

#if false

#define foo

#endif

class myClass {
  int member;
}

#if false

#error this error does not trigger

#undef foo
// "cannot define or undefine preprocessor symbols after first token in file

#endif

I understand the rule about not #undefing a preprocessor symbol after a token has been declared, but in this case i'm not #undefing because the #undef is inside a #if false.

This example is not entirely contrived, it's an attempt to get a single source file to compile in both C# and C++ via the approach described here.

Community
  • 1
  • 1
orion elenzil
  • 4,484
  • 3
  • 37
  • 49

1 Answers1

1

Visual Studio doesn't complain about the same code. I think you have discovered a bug in Mono.

Jacob Krall
  • 28,341
  • 6
  • 66
  • 76