GNOME Bugzilla – Bug 131989
#if isn't recognized as a preprocessor, which is valid in C#
Last modified: 2009-08-20 10:13:03 UTC
Microsoft changes "#ifdef" to "if" in C# and managed C++. But doxygen doesn't recognize it as a preprocessor. It will be great if doxygen can recognize it.
Can you please provide an example?
example at http://msdn.microsoft.com/library/en-us/csref/html/vclrfIf.asp?frame=true More to the point, there is no change to the C++ behavior. C# doesn't have proper macros, every #define'd value is treated as true. So in a C# file, #define NAME should set NAME to 1 instead of the empty string.
I get a "Content not found" error for that page. Any other info?
As is usual for the MSDN web site, it moved. Here is the address for the newest documentation: http://msdn.microsoft.com/en-us/library/4y6tbswk.aspx
Dimitri, you requested information has been provided in comment #4. I am thus reopening.
I would also very much like this bug to be fixed. C# preprocessor is more primitive than C/C++ one. The MSDN page provided in comment #4 contains all the info about it one might need. Please consider the following short example: #define DEF1 #define DEF2 using System; namespace WindowsApplication1 { class Class2 { private Class1 x = new Class1(); public void y() { #if DEF1 x.c(); #elif DEF2 x.d(); #endif } } } In this case, x.c() will be called. If I remove the #define DEF1 line, x.d() will be called. However, Doxygen doesn't parse this syntax properly: Class2.cs:17: Problem during constant expression evaluation: syntax error Class2.cs:19: Problem during constant expression evaluation: syntax error I suppose the previous comment gives the right solution idea: "So in a C# file, #define NAME should set NAME to 1 instead of the empty string." Thank you and keep up the good work! :)
Thanks for the additional information. I'll implement this fix in the next subversion update.
This bug was previously marked ASSIGNED, which means it should be fixed in doxygen version 1.6.0. Please verify if this is indeed the case and reopen the bug if you think it is not fixed (include any additional information that you think can be relevant).