Re: [AD] trying to make allegro compatible with MFC |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
> 1/. The code fragment:
> [...]
> will expand to `RGB(a, b, c)' (ref. 1), regardless of what RGB was
> defined to be originally. So a #define line behaves as if no macros
> were defined.
Ok, that's what I found with MinGW32. The MSVC preprocessor seems to behave
differently with regard to cascaded macros.
> 2/. The code fragment:
>
> #define RGB(a, b, c) /* some function of (a, b, c) */
> #define RGB struct allegro_rgb
>
> would define two different things, and is perfectly legal. The first
> definition would be used if `RGB(' was encountered, and the second
> would be used if `RGB?', where `?' is anything but `('. (ref. 2)
>
> If the second behaviour holds true on non-gcc C preprocessors, then I
> believe we have solved the problem; we just rename the RGB structure to
> allegro_rgb, and provide a #definition of it.
>
> Otherwise, we could test for gcc (#ifdef __GNUC__) and act accordingly.
Very clever. However, I think that's overkill and we shouldn't modify again
the core code just for a very minor problem in a single port.
Thanks for the detailed informations.
-Eric