[aquaria] Visual Studio naming conflicts

Chris Gelatt kreeblah at gmail.com
Sun Jul 11 14:54:42 EDT 2010

Huh.  I hadn't even considered something like that, but that's really
clever.  My first thought was actually a namespace, but that would have been
far more editing than I really wanted to do, so this solves that problem
quite nicely and doesn't have the awkward naming like in my other patch.
 I've attached another one with this method instead along with the missing
libraries that I mentioned before, so hopefully it can be reviewed by

On Sun, Jul 11, 2010 at 06:36, Andrew Church
<achurch+aquaria at achurch.org<achurch%2Baquaria at achurch.org>
> wrote:

> >I did some checking and it turns out that InputMode, INPUT_MOUSE, and
> >INPUT_KEYBOARD in there are all already defined by Visual Studio.  So is
> >hash() in Base.h/cpp, as I later found.  After renaming those (along with
> >INPUT_JOYSTICK, for consistency), I was able to compile fine, so I wanted
> to
> >submit a patch for this.
> Another possibility is to just redefine/undefine those specific macros
> when building in Visual Studio -- that would be my suggestion, as it
> avoids the need to rewrite identifiers in dozens of different files.
> This could probably be done in BBGE/Base.h, with something like:
> // Rename anything that's a type or function (not a #define).
> #ifdef _MSC_VER
> #define InputMode _MSC_InputMode
> #define hash _MSC_hash
> #endif
> // System #includes go here.
> // Undefine the renaming macros as well as other macros defined by the
> // system headers that we don't want.
> #ifdef _MSC_VER
> #undef InputMode
> #undef INPUT_MOUSE
> #undef hash
> #endif
> This is the approach I've used in my own cross-platform work, though
> usually just to work around identifier shadowing warnings.  (I'd
> certainly like to have a few words with whoever on the POSIX committee
> thought it would be a good idea to have global library functions named
> y0() and y1()...)
>  --Andrew Church
>    achurch at achurch.org
>    http://achurch.org/
> _______________________________________________
> aquaria mailing list
> aquaria at icculus.org
> http://icculus.org/mailman/listinfo/aquaria
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://icculus.org/pipermail/aquaria/attachments/20100711/eff5090f/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vc_compilation_fix.patch
Type: application/octet-stream
Size: 18259 bytes
Desc: not available
URL: <http://icculus.org/pipermail/aquaria/attachments/20100711/eff5090f/attachment-0001.obj>

More information about the aquaria mailing list