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