help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Interesting problem with bison on Windows


From: Laurence Finston
Subject: Re: Interesting problem with bison on Windows
Date: Fri, 19 Oct 2007 18:05:46 +0200 (CEST)

On Fri, 19 Oct 2007, address@hidden wrote:

> Yes, using "#undef IN" after the inclusion of WinDef.h works, but it
> seems like a bit of a hack.  By getting "those who wrote it to fix
> it", if you mean WinDef.h, it's a header from Visual Studio.
> Somehow, I doubt that I could get Microsoft to "fix" that header.
> I'd still like to understand why defining YYTOKENTYPE on the command
> line broke the link.  It sure looks like the code was written to
> give this option to not include the enum.  

I don't know what the connection could be with `YYTOKENTYPE' or what
it has to do with an `enum'.  I do know that it is a very bad idea to
have preprocessor macros that interfere with the ones defined for
tokens in Bison.  If a header file needs preprocessor macros, they
should be undefined at the end of the file, unless they are part of
the interface defined by the header and (presumably) the library it
refers to.  Defining a macro named `IN' is asking for trouble.

For you to undefine it isn't hacky, it's prudent and good programming
practice.  You are cleaning up the mess somebody else left.  Having
worked with Visual Studio and other Microsoft products, I am not
surprised that you reported this.  If it were me, I would go through
that header and see what other macros it defines.

I would prefer that Bison not use preprocessor macros, but rather `const
ints', but it's not up to me.  There may be some reason this wouldn't
work.  

Laurence Finston




reply via email to

[Prev in Thread] Current Thread [Next in Thread]