🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #1214

Re: space optimization involving enum

#1214
From: Barry Margolin
Date: Tue, 25 Aug 1992 18:55
20 lines
1433 bytes
In article <1992Aug25.153909.17977@email.tuwien.ac.at> hp@vmars.tuwien.ac.at (Peter Holzer) writes:
>When the callee is compiled, the compiler cannot know if there is a
>prototype in scope of the caller.

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).

In particular, with K&R declarations, chars are always widened to ints when
calling a function, while with ANSI prototypes they're passed as chars.
This is very similar to the enum conversion that you were talking about.

-- 
Barry Margolin
System Manager, Thinking Machines Corp.

barmar@think.com          {uunet,harvard}!think!barmar
Technical Details
Message-ID: <17dvn3INNglh@early-bird.think.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!mips!think.com!barmar
References: <spuler.714711530@coral.cs.jcu.edu.au> <1992Aug25.153909.17977@email.tuwien.ac.at>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!dtix!darwin.sura.net!mips!think.com!barmar
From: barmar@think.com (Barry Margolin)
Newsgroups: comp.std.c
Subject: Re: space optimization involving enum
Message-ID: <17dvn3INNglh@early-bird.think.com>
Date: 25 Aug 92 18:55:31 GMT
References: <spuler.714711530@coral.cs.jcu.edu.au> <1992Aug25.153909.17977@email.tuwien.ac.at>
Organization: Thinking Machines Corporation, Cambridge MA, USA
Lines: 20
NNTP-Posting-Host: telecaster.think.com