home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #18 / NN_1992_18.iso / spool / comp / std / c / 2487 < prev    next >
Encoding:
Internet Message Format  |  1992-08-21  |  2.6 KB

  1. Path: sparky!uunet!snorkelwacker.mit.edu!thunder.mcrcim.mcgill.edu!sobeco!philmtl!vedge!hendrik
  2. From: hendrik@vedge.UUCP (Hendrik Boom)
  3. Newsgroups: comp.std.c
  4. Subject: Re: mixing prototyping and non-prototyping
  5. Message-ID: <28617@vedge.UUCP>
  6. Date: 21 Aug 92 13:56:37 GMT
  7. References: <1992Aug20.044426.19417@bnr.ca>
  8. Organization: Visual Edge Software, St. Laurent, Quebec
  9. Lines: 54
  10.  
  11. davisonj@bnr.ca (John Davison) writes:
  12. : In article <28616@vedge.UUCP> hendrik@vedge.UUCP (Hendrik Boom) writes:
  13.  
  14. : >To make this work at least some of the time,
  15. : >a function defined using old-style syntax,
  16. : >will expect its parameters to have been converted
  17. : >using the standard argument promotion rules.
  18. : >
  19. : >A function with a single real argument, such as
  20. : >    f(r)real r;{    }
  21. :         You did not define "real".
  22. My mistake. I've spent ten years coding in C, ten years making
  23. this mistake, and ten years being reminded by a compiler
  24. what a nitwit I am!  Of course I mean float.
  25.  
  26. : >(a)    Include parameters in function declarations
  27. : >    conditional on the absence of _NO_PROTO.
  28. : ...
  29. : >Its use is not dictated or mentioned by the ANSI standard.
  30. :     To determine if a compiler is Standard C, the existence and value (should
  31. : be 1 in standard C) of __STDC__ should be checked.
  32.  
  33. Right, __STDC__ tells me whether the compiler is standard C, in which case
  34. it would be expected to accept prototypes.  But I use _NO_PROTO to tell
  35. the include files whether to provide prototypes -- which is a different
  36. issue:
  37.     - it enables me to test the software in a mode in which an
  38.       end-user with a nonprototyping compiler might use it).
  39.     - Nonstandard compilers sometimes do accept prototypes
  40.       without defining __STDC__
  41.     - Compilers defining __STDC__ to 1 occasionally have bugs
  42.       and fail to do prototypes correctly (this is rare)
  43.  
  44. The specific word _NO_PROTO was chosen because it is used for this purpose
  45. in a lot of manufacturers' include files on UNIX.  So many, in fact,
  46. that I wonter whether there is some standard other tnat ANSI C that
  47. mandates this.  Is there some edict from OSF? X/OPEN? POSIX? Anyone know?
  48.  
  49. : -- 
  50. : NOTE: I CAN'T SEND/RECEIVE E-MAIL HERE!!!  Use --> davisonj@ecn.purdue.edu <--
  51. :       During (roughly) August 20-25, I will be in transit.  Please be patient.
  52. :       The opinions and other information contained herein are not necessarily
  53. :       representative of Northern Telecom or any of its subsidiaries. 
  54. -- 
  55. -------------------------------------------------------
  56. Try one or more of the following addresses to reply.
  57. at work:    hendrik@vedge.com,  iros1!vedge!hendrik
  58. at home:    uunet!altitude!ozrout!topoi!hendrik
  59.