gnustep-dev
[Top][All Lists]
Advanced

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

[RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?)


From: Alexander Malmberg
Subject: [RFA]: BOOL coding standards (Was: Problem with +numberWithBool: ?)
Date: Fri, 30 Jan 2004 17:00:49 +0100

Manuel Guesdon wrote:
> My rule: be strict for output and flexible for input :-)

A very good rule. :)

http://www.faqs.org/docs/jargon/P/Postel's-Prescription.html

> So what do we do ?

I've attached a patch to our coding standards. OK to commit? If so, new
code will work ok, and I'll get to work on patching core/ (hopefully
with some help from David Ayers :).

- Alexander Malmberg
Index: Documentation/coding-standards.texi
===================================================================
RCS file: 
/cvsroot/gnustep/gnustep/core/base/Documentation/coding-standards.texi,v
retrieving revision 1.8
diff -u -r1.8 coding-standards.texi
--- Documentation/coding-standards.texi 22 Sep 2003 03:00:21 -0000      1.8
+++ Documentation/coding-standards.texi 30 Jan 2004 14:17:35 -0000
@@ -63,6 +63,7 @@
 * Variable Declaration::        
 * Object Persistance::          
 * Contributing::                
+* BOOLs::
 @end menu
 
 @c ******************************************************************
@@ -348,7 +349,7 @@
 
 
 @c ******************************************************************
address@hidden Object Persistance, Contributing, Variable Declaration, Top
address@hidden Object Persistance, BOOLs, Variable Declaration, Top
 @section Object Persistance
 
 The standard method of saving and restoring object information in GNUstep
@@ -361,7 +362,19 @@
 should be read.
 
 
address@hidden Contributing,  , Object Persistance, Top
address@hidden 
******************************************************************
address@hidden BOOLs, Contributing, Object Persistance, Top
address@hidden BOOLs
+
+BOOL values are normal c truth values. Any non-zero value (i.e. any value
+not equal to NO) is true. Thus, BOOL values must never be compared against
+YES since this doesn't correctly handle true values other than YES.
+
+Methods that return BOOL values should try to return only YES or NO to
+avoid triggering problems in code that doesn't handle BOOL values correctly.
+
+
address@hidden Contributing,  , BOOLs, Top
 @section Contributing
 
 Contributing code is not difficult. Here are

reply via email to

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