gnustep-dev
[Top][All Lists]
Advanced

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

Re[2]: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool:


From: Manuel Guesdon
Subject: Re[2]: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?)
Date: Fri, 30 Jan 2004 20:08:03 +0100 (CET)

On Fri, 30 Jan 2004 17:11:42 +0000 (GMT) Nicola Pero <address@hidden> wrote:
 >| I don't have particular objections to change 'if ([this canDoThat] ==
 >| YES)' into 'if ([this canDoThat])', if we write clearly in the coding
 >| standards that this can be done only for methods returning a BOOL, and
 >| that everything else (pointers, integers, etc) must be compared against
 >| something.  So whenever you'd see 'if ([this doThat])' you know that the
 >| result type must have been a BOOL since it's compared to nothing.

I think that 
        if (MyPtr)
is more readable than
        if (MyPtr == NULL)
because it's shorter and still easily understandable buts it's only my opinion 
:-)

This last one can also be a source of typos like
        if (MyPtr = NULL)
even if compiler often emit a warning for this case.


Richard's IsYes() macro proposition seems interesting when you know that the 
method should return a 'real' BOOL.

Just my 2 cents...

Manuel
-- 
______________________________________________________________________
Manuel Guesdon - OXYMIUM <address@hidden>
14 rue Jean-Baptiste Clement  -  93200 Saint-Denis  -  France
Tel: +33 1 4940 0999  -  Fax: +33 1 4940 0998





reply via email to

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