Article View: comp.std.c
Article #1162Re: mixing prototyping and non-prototyping
From: Hendrik Boom
Date: Fri, 21 Aug 1992 13:56
Date: Fri, 21 Aug 1992 13:56
54 lines
2709 bytes
2709 bytes
davisonj@bnr.ca (John Davison) writes:
:
: In article <28616@vedge.UUCP> hendrik@vedge.UUCP (Hendrik Boom) writes:
: >To make this work at least some of the time,
: >a function defined using old-style syntax,
: >will expect its parameters to have been converted
: >using the standard argument promotion rules.
: >
: >A function with a single real argument, such as
: > f(r)real r;{ }
:
: You did not define "real".
:
My mistake. I've spent ten years coding in C, ten years making
this mistake, and ten years being reminded by a compiler
what a nitwit I am! Of course I mean float.
: >(a) Include parameters in function declarations
: > conditional on the absence of _NO_PROTO.
: ...
: >Its use is not dictated or mentioned by the ANSI standard.
:
: To determine if a compiler is Standard C, the existence and value (should
: be 1 in standard C) of __STDC__ should be checked.
:
Right, __STDC__ tells me whether the compiler is standard C, in which case
it would be expected to accept prototypes. But I use _NO_PROTO to tell
the include files whether to provide prototypes -- which is a different
issue:
- it enables me to test the software in a mode in which an
end-user with a nonprototyping compiler might use it).
- Nonstandard compilers sometimes do accept prototypes
without defining __STDC__
- Compilers defining __STDC__ to 1 occasionally have bugs
and fail to do prototypes correctly (this is rare)
The specific word _NO_PROTO was chosen because it is used for this purpose
in a lot of manufacturers' include files on UNIX. So many, in fact,
that I wonter whether there is some standard other tnat ANSI C that
mandates this. Is there some edict from OSF? X/OPEN? POSIX? Anyone know?
:
: --
: NOTE: I CAN'T SEND/RECEIVE E-MAIL HERE!!! Use --> davisonj@ecn.purdue.edu <--
: During (roughly) August 20-25, I will be in transit. Please be patient.
: The opinions and other information contained herein are not necessarily
: representative of Northern Telecom or any of its subsidiaries.
--
-------------------------------------------------------
Try one or more of the following addresses to reply.
at work: hendrik@vedge.com, iros1!vedge!hendrik
at home: uunet!altitude!ozrout!topoi!hendrik
Technical Details
Message-ID:
<28617@vedge.UUCP>Path:
arc1-ca.pugleaf.net!sparky!uunet!snorkelwacker.mit.edu!thunder.mcrcim.mcgill.edu!sobeco!philmtl!vedge!hendrikReferences:
<1992Aug20.044426.19417@bnr.ca>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!snorkelwacker.mit.edu!thunder.mcrcim.mcgill.edu!sobeco!philmtl!vedge!hendrik From: hendrik@vedge.UUCP (Hendrik Boom) Newsgroups: comp.std.c Subject: Re: mixing prototyping and non-prototyping Message-ID: <28617@vedge.UUCP> Date: 21 Aug 92 13:56:37 GMT References: <1992Aug20.044426.19417@bnr.ca> Organization: Visual Edge Software, St. Laurent, Quebec Lines: 54