[haiku-development] Re: Pairs game

  • From: "Michael Lotz" <mmlr@xxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sun, 20 Apr 2008 12:33:34 +0200

Hi Ralf

> The NULL instead of 0 , here i have no warnings, can you me say what 
> did i 
> wrong?

For example this warning is generated:

src/apps/pairs/PairsWindow.cpp:30: warning: converting NULL to non-
pointer type

Which happens because you initialize the int fPairCard member which is 
int to a pointer (NULL). This is not really what you want, you just 
want it initialized to 0, so you should just say "fPairCard = 0". NULL 
is only to be used with pointers like with for "const char *string = 
NULL". You have that in PairsWindow.cpp lines 30-35 and then again in 
lines 84, 88 and 123-128. Also in lines 78 and 82 you do an integer - 
pointer comparison when you do "fPairCardTmp == NULL" which is again 
not really what you want. You just want "fPairCardTmp == 0". This then 
generates the warning:

src/apps/pairs/PairsWindow.cpp:82: warning: NULL used in arithmetic


Other related posts: