home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / c / 16153 < prev    next >
Encoding:
Text File  |  1992-11-08  |  1.2 KB  |  29 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!utcsri!torn!utzoo!telly!druid!darcy
  3. From: darcy@druid.uucp (D'Arcy J.M. Cain)
  4. Subject: Re: How to use 'return' in c?
  5. Message-ID: <1992Nov7.122126.24409@druid.uucp>
  6. Date: Sat, 7 Nov 1992 12:21:26 GMT
  7. References: <1992Oct29.025437.9289@nuscc.nus.sg> <1992Nov2.203701.162@ipact.com>
  8. Organization: D'Arcy Cain Consulting
  9. Lines: 18
  10.  
  11. allebrandi@ipact.com writes:
  12. >The best thing to do is to use manifest constants to implicitly document
  13. >the value you are returning. For example, return TRUE or FALSE not 1 or
  14. >0 for a boolean function return.
  15.  
  16. Whenever I see TRUE and FALSE in code I am maintaining I remove the
  17. #defines.  If they are defined, they should never be anything but
  18. TRUE = 1 and FALSE = 0.  Anything else is confusing and misleading.
  19. Given this why force the maintainer to go searching for the definitions
  20. to make sure that they are what they should never be anything but?
  21. This isn't as bad as #defining SEVEN as 7 but it is in the same category
  22. I think.
  23.  
  24. -- 
  25. D'Arcy J.M. Cain (darcy@druid.com)  |
  26. D'Arcy Cain Consulting              |   There's no government
  27. Toronto, Ontario, Canada            |   like no government!
  28. +1 416 424 2871          DoD#0082   |
  29.