🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.c
Article #4102

Re: Function-prototype scope: Why?

#4102
From: Christopher R. Volpe
Date: Mon, 25 Sep 1995 13:35
50 lines
3014 bytes
In article <43vma2$8l4@caip.rutgers.edu>, halasz@caip.rutgers.edu writes:

>: You complain that the compiler is
>: "permitted to generate code and warning". What you don't realize is that the
>: compiler is ALWAYS permitted to generate code and a warning, no matter how bad
>: your source code is. The Standard *requires* a diagnostic for this kind of
>: parameter mismatch, and that's the best the Standard can do.
>Erm, no--the standard-writers are free to write that that is no
>C-program, but, it seems, thei hav not.

You're not listening. They *did* write that "that is no C program". A
translation unit that has syntax errors and/or violates constraints is not a C
program. But there is nothing that says that a compiler cannot take its best
guess about what you wanted the program to do and generate code to do that
anyway, as long as it produces the obligatory diagnostic.

>  I ween that this is a matter
>of holding to the tradition of compiling C-programs that seem unsafe.
>It seems quite hard to hold to this tradition and withal write a standard
>that rightlie and meaningfullie states it, what a C-program or C-compiler is.

"Error: The above are not valid English sentences"

However, I think I can take a guess at what you mean. (Or would you have me
abort this post here and now?) The Standard says precisely what a strictly
conforming program is, and what a valid C compiler is. And it even says what
is definitely *not* a C program, by specifying things that require
diagnostics. It does not follow that a compiler should not be allowed to
generate code, even if the user wants it.

>Tanmoy@qcd.lanl.gov claims that the standard in this matter has faild.

Tanmoy said that the Standard shouldn't allow compilers to generate code for
translation units that violate *any* constraint whatsoever? That doesn't sound
like something Tanmoy would say...

>: What is a bad hack? F-p scope? Perhaps. What's your solution that allows
>: declarations like the above without namespace corruption?
>(Yes.)  Putting onlie the parameter-name into fp-scope,
>not new type-names and tags.

I tend to prefer simpler rules. "Declared identifiers exist from the point of
declaration to the end of the scope in which they are declared." Nice and
simple. 

--

Chris Volpe				Phone: (518) 387-7766 (Dial Comm 8*833
GE Corporate R&D			Fax:   (518) 387-6560
PO Box 8, Schenectady, NY 12301		Email: volpecr@crd.ge.com
Technical Details
Message-ID: <446b6d$r5n@rdsunx.crd.ge.com>
Path: arc1-ca.pugleaf.net!bart.crd.ge.com!volpe
References: <43cgmb$cec@news0.rain.rg.net> <43er80$458@caip.rutgers.edu> <43uhlf$hhi@rdsunx.crd.ge.com> <43vma2$8l4@caip.rutgers.edu>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!bart.crd.ge.com!volpe
From: volpe@bart.crd.ge.com (Christopher R. Volpe)
Newsgroups: comp.std.c
Subject: Re: Function-prototype scope: Why?
Date: 25 Sep 1995 13:35:09 GMT
Organization: GE Corporate Research & Development
Sender: volpe@bart (Christopher R. Volpe)
Distribution: world
Message-ID: <446b6d$r5n@rdsunx.crd.ge.com>
References: <43cgmb$cec@news0.rain.rg.net> <43er80$458@caip.rutgers.edu> <43uhlf$hhi@rdsunx.crd.ge.com> <43vma2$8l4@caip.rutgers.edu>
Reply-To: volpe@ausable.crd.ge.com
NNTP-Posting-Host: bart.crd.ge.com