[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?)
From: |
Pascal J . Bourguignon |
Subject: |
Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?) |
Date: |
Sun, 8 Feb 2004 02:37:14 +0100 |
David Ayers writes:
> You can't rely on the C truth value (i.e. rely on the "true" value or
> 256) to be passed through the method invocation which converts the
> integer to unsgnied char in this case '0' and expect to have get the
> 'YES' BOOL value as the parameter in the implementation of +numberWithBool.
>
> IOW: C "truths" (i.e. C truth semantice) aren't implicitly converted to
> BOOL YES/NO. The conversion must be made explict.
But who in his sane mind would write:
> >> [NSNumber numberWithBool: (i=256)]; => NO
instead of:
[NSNumber numberWithBool: (i=256)!=0]; => YES
?
For a time I had this '.signature' file. Perhaps I should have kept it
longer:
void PleaseWrite(bool isBetter,void* pointer,int value)
{if((!isBetter)&&(pointer!=NULL)||(value==0)){ print("Right!\n");}}
void DontBeSilly(bool isSilly,void* pointer,int value)
{if((isSilly!=true)&&(pointer)||(!value)){ print("Wrong!!\n"); }}
--
__Pascal_Bourguignon__ http://www.informatimago.com/
There is no worse tyranny than to force a man to pay for what he doesn't
want merely because you think it would be good for him.--Robert Heinlein
http://www.theadvocates.org/
- RE: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?), Adam Fedor, 2004/02/05
- Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?), Richard Frith-Macdonald, 2004/02/07
- Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?), David Ayers, 2004/02/07
- Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?), Kazunobu Kuriyama, 2004/02/07
- Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?), David Ayers, 2004/02/07
- Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?),
Pascal J . Bourguignon <=
- Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?), Nicola Pero, 2004/02/07
- Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?), Kazunobu Kuriyama, 2004/02/09
- Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?), Pascal J . Bourguignon, 2004/02/09
- Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?), David Ayers, 2004/02/09
- Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?), Richard Frith-Macdonald, 2004/02/09
- Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?), Pascal J . Bourguignon, 2004/02/09
- Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?), David Ayers, 2004/02/09
- Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?), Kazunobu Kuriyama, 2004/02/09
- Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?), Pascal J . Bourguignon, 2004/02/09
- Re: [RFA]: BOOL coding standards (Was: Problemwith+numberWithBool:?), Kazunobu Kuriyama, 2004/02/10