🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1218

Re: space optimization involving enum

#1218
From: Steve Clamage
Date: Wed, 26 Aug 1992 18:42
33 lines
1587 bytes
barmar@think.com (Barry Margolin) writes:

>Actually, doesn't the standard require that function
>declarations/prototypes and definitions be consistent with each other?  If
>the function is defined with an ANSI parameter list, the caller must have a
>prototype in scope.  If the function is defined with a K&R1 parameter list,
>the caller can use an old-style declaration (or no declaration at all,
>letting it default, if the function returns int).

Not quite.  You are allowed to mix prototype and non-prototype
declarations and definition of the same function, provided the
promotions implied by the non-prototype declaration/definition
do not result in any changes.  In practice, this means not using
any parameters of type char, short, or float.  If enums are smaller
than ints, avoid those too.

Conforming examples:

int foo(int, long, double); /* prototype */

foo(i, l, d) /* implicit int return and int type for 'i' */
long l;
double d;
{ ... }

int bar();	/* declaration */

int bar(int i, long l, double d) /* prototyped header */
{ ... }
-- 

Steve Clamage, TauMetric Corp, steve@taumet.com
Vice Chair, ANSI C++ Committee, X3J16
Technical Details
Message-ID: <1992Aug26.184220.8236@taumet.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!taumet!steve
References: <spuler.714711530@coral.cs.jcu.edu.au> <1992Aug25.153909.17977@email.tuwien.ac.at> <17dvn3INNglh@early-bird.think.com>

Show Full Headers
Complete Article Headers
Newsgroups: comp.std.c
Path: arc1-ca.pugleaf.net!sparky!uunet!taumet!steve
From: steve@taumet.com (Steve Clamage)
Subject: Re: space optimization involving enum
Message-ID: <1992Aug26.184220.8236@taumet.com>
Organization: TauMetric Corporation
References: <spuler.714711530@coral.cs.jcu.edu.au> <1992Aug25.153909.17977@email.tuwien.ac.at> <17dvn3INNglh@early-bird.think.com>
Date: Wed, 26 Aug 1992 18:42:20 GMT
Lines: 33