[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Re: Remove STRICT ifdef in Wine code
From:       Francois Gouget <fgouget () free ! fr>
Date:       2000-12-30 4:02:04
[Download RAW message or body]

On 29 Dec 2000, Alexandre Julliard wrote:

> François Gouget <fgouget@codeweavers.com> writes:
> 
> >    The current way to do it (i.e. the one that does not generate
> > warnings) is to write:
> >    HWND hNullHandle = 0;
> > 
> >    but when HANDLE becomes a pointer it should become:
> >    HWND hNullHandle = NULL;
> 
> IMNSHO it might just as well remain as 0. There is no need to change
> it, 0 and NULL mean the same thing anyway, and 0 can be used
> everywhere without having to look up whether the handle is defined as
> a pointer or an int.

   I guess I'm too used to getting a warning because some code makes a
pointer from an integer without cast.
   I realize now that it only applies to variables and non-zero
constants.
   0 is the exception:

   int i=0;
   void* p1=i;    /* Bad */
   void* p2=3;    /* Bad */
   void* p3=0;    /* No warning!!! */



> >    This will mean tons of locs to change. And this change cannot be
> > automatised because it's hard to know which 0s must be changed to NULL.
> > See for an example of this my CreateFile patch. What I propose is to
> > write:
> >    HWND hNullHandle = (HWND)NULL;
> 
> Casting NULL is particularly ugly IMHO. Simply using 0 is much better.

   I agree that casting NULL is ugly so I really want it to be
temporary. But I really don't like using 0 instead of NULL either so I'm
willing to have these casts temporarily if it can help me get to a
point where we use NULL rather than 0.

   But I'm no integrist (well, not today) so I'll do as you want (maybe
I'll try to keep the patch around to be able to reapply without cast
once the switch is over).

  Should I resubmit the STRICT and CreateFile patches?


--
Francois Gouget         fgouget@free.fr        http://fgouget.free.fr/
May your Tongue stick to the Roof of your Mouth with the Force of a Thousand Caramels.

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic