bug-gnubg
[Top][All Lists]
Advanced

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

Re: [Bug-gnubg] Proposed patches to the gnubg sources


From: Jon Kinsey
Subject: Re: [Bug-gnubg] Proposed patches to the gnubg sources
Date: Mon, 07 Feb 2005 15:55:43 +0000
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.5) Gecko/20041206 Thunderbird/1.0 Mnenhy/0.7

Jim Segrave wrote:

Here's a cleaner alternative:

in the various board3d files GL/gl.h and sometimes other GL/xxx.h
files are included. Why not create a local include file - glstuff.h

glstuff.h:

#ifndef _GLSTUFF_H
#define _GLSTUFF_H
#if WIN32
#include <windows.h>
#endif

#include <GL/gl.h>
#include <GL/xxx.h>
...etc...
#endif /* _GLSTUFF_H */

Then replace all the GL/xxx.h includes with this single one. That
leaves the distribution files unscathed, ensures that windows.h is
always read if needed and makes the .c files a tiny bit shorter

Ok, I'll check something like that in.

But that makes me wonder:

in widget3d.c, near the top there is
#if !WIN32
#include <GL/glx.h>
#endif

Which assumes WIN32 is #defined and set to FALSE
later there is

#ifdef WIN32

#ifndef PFD_GENERIC_ACCELERATED
#define PFD_GENERIC_ACCELERATED     0x00001000
#endif

Which is going to be active, even if WIN32 is defined as FALSE, since
the test is for definition, not the value.

Yes, we should avoid #ifdefs and if necessary use #if defined().  This
code will be alright as WIN32 won't be defined (and #if !WIN32 would be
true by default) - on non-window platforms.

If I feel extra keen I'll remove a few of the #ifdef's...

Jon

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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