Article View: comp.std.c
Article #4086Re: Function-prototype scope: Why?
From: halasz
Date: Sat, 23 Sep 1995 01:01
Date: Sat, 23 Sep 1995 01:01
33 lines
2447 bytes
2447 bytes
In article <43uhlf$hhi@rdsunx.crd.ge.com>, volpe@bart.crd.ge.com (Christopher R. Volpe) writes : So, perhaps my misinderstanding is not totally inexplicable. *sigh* You hav a point. : I don't understand this. If you try passing a pointer to one kind of struct to : a function that accepts a pointer to a different kind of struct, the compiler : is *required* to issue a diagnostic. More examples of the failure of my notion that f-p scope is helpful in preventing bad function-calls, _if_ all pointers shall hav the same shape: then f-p scope is thereto irrelevant, although it can prevent a function-call, and, furthermore, that just as unsafe calls are not prevented. : 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. 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. Tanmoy@qcd.lanl.gov claims that the standard in this matter has faild. : Couldn't make sense of the above. Pointer types don't get "promoted" in old C. That is so; I meant onlie that older C lackind parameter-declaration that the caller sees has this hack that lessend the unsafeness of it: not passing 'char', 'short int', 'float', but instead longer forms, which, among other things, lets the caller "safelie" put constants in a call. : 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.
Technical Details
Message-ID:
<43vma2$8l4@caip.rutgers.edu>Path:
arc1-ca.pugleaf.net!caip.rutgers.edu!not-for-mailReferences:
<43cgmb$cec@news0.rain.rg.net> <43er80$458@caip.rutgers.edu> <43uhlf$hhi@rdsunx.crd.ge.com>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!caip.rutgers.edu!not-for-mail From: halasz@caip.rutgers.edu Newsgroups: comp.std.c Subject: Re: Function-prototype scope: Why? Date: 22 Sep 1995 21:01:54 -0400 Organization: Rutgers University Message-ID: <43vma2$8l4@caip.rutgers.edu> References: <43cgmb$cec@news0.rain.rg.net> <43er80$458@caip.rutgers.edu> <43uhlf$hhi@rdsunx.crd.ge.com> NNTP-Posting-Host: caip.rutgers.edu