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

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!ukma!asuvax!cs.utexas.edu!csc.ti.com!tilde.csc.ti.com!mksol!mccall
  3. From: mccall@mksol.dseg.ti.com (fred j mccall 575-3539)
  4. Subject: Re: How to use 'return' in c?
  5. Message-ID: <1992Nov9.190838.3391@mksol.dseg.ti.com>
  6. Organization: Texas Instruments Inc
  7. References: <1992Nov7.122126.24409@druid.uucp> <gm5XTB3w165w@quest.UUCP>
  8. Date: Mon, 9 Nov 1992 19:08:38 GMT
  9. Lines: 26
  10.  
  11. In <gm5XTB3w165w@quest.UUCP> kdq@quest.UUCP (Kevin D. Quitt) writes:
  12.  
  13. >darcy@druid.uucp (D'Arcy J.M. Cain) writes:
  14.  
  15. >> allebrandi@ipact.com writes:
  16. >> >The best thing to do is to use manifest constants to implicitly document
  17. >> >the value you are returning. For example, return TRUE or FALSE not 1 or
  18. >> >0 for a boolean function return.
  19. >> 
  20. >> Whenever I see TRUE and FALSE in code I am maintaining I remove the
  21. >> #defines.  If they are defined, they should never be anything but
  22. >> TRUE = 1 and FALSE = 0.  Anything else is confusing and misleading.
  23.  
  24. >    On the other hand, since C does not truly support the boolean type,
  25. >I consider it misleading to assign a numeric value to a boolean.  I
  26. >define TRUE as (1==1) because the result of this is a boolean - the
  27. >fact that it is represented by a numerical value is misleading.
  28.  
  29. No, the result of this is *1*.  If it is anything else, your compiler
  30. is seriously broken.
  31.  
  32. -- 
  33. "Insisting on perfect safety is for people who don't have the balls to live
  34.  in the real world."   -- Mary Shafer, NASA Ames Dryden
  35. ------------------------------------------------------------------------------
  36. Fred.McCall@dseg.ti.com - I don't speak for others and they don't speak for me.
  37.