Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #26146

Re: Params -> local vars?

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: Params -> local vars?
Date 2012-09-08 11:14 -0700
Organization None to speak of
Message-ID <lnsjasjs9v.fsf@nuthaus.mib.org> (permalink)
References <jv6nmr$15k$1@speranza.aioe.org> <kfn8vclh8j4.fsf@x-alumni2.alumni.caltech.edu> <lna9x1s583.fsf@nuthaus.mib.org> <kfnbohgyavl.fsf@x-alumni2.alumni.caltech.edu>

Show all headers | View raw


Tim Rentsch <txr@alumni.caltech.edu> writes:
> Keith Thompson <kst-u@mib.org> writes:
>> Tim Rentsch <txr@alumni.caltech.edu> writes:
>> [...]
>>> 3. The prototype style of parameter declaration allows (and requires)
>>> any call after the prototype declaration to have the types of its
>>> arguments checked against the parameter types given in the prototype.
>>> In contrast, the old style of parameter declaration does not do
>>> such type checking (and the Standard says specifically that such
>>> type checking will not be done).
>> [...]
>>
>> Checking is not *required*, but an implementation is free to perform it
>> anyway.  [snip example]
>
> Talking about function calls, 6.5.2.2 p 8 says "the number and
> types of arguments are not compared with those of the parameters
> in a function definition that does not include a function
> prototype declarator."

The full paragraph is:

    No other conversions are performed implicitly; in particular,
    the number and types of arguments are not compared with those
    of the parameters in a function definition that does not include
    a function prototype declarator.

> You're right that implementations are free to issue any
> diagnostics they want.  At the same time, what is in those
> diagnostics cannot depend on the results of comparisons
> that implementations are prohibited from making.

My suspicion is that the intent was not to forbid making those
comparisons, just that any argument conversions should not depend
on such comparisons.  It certainly does *say* that the comparisons
are not performed, but it's in the context of implicit conversions.

It doesn't make much sense to forbid a compiler to perform
comparisons don't necessarily have any effect.  And as long as
old-style function definitions are in the language, it would be nice
if some compilers could warn about calls with mismatched arguments.

Off to comp.std.c.

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
    Will write code for food.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Params -> local vars? Jon Howson <nospam@nospam.com> - 2012-07-30 19:35 +0000
  Re: Params -> local vars? Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-07-30 15:54 -0400
  Re: Params -> local vars? James Kuyper <jameskuyper@verizon.net> - 2012-07-30 16:00 -0400
  Re: Params -> local vars? Kenneth Brody <kenbrody@spamcop.net> - 2012-07-30 16:01 -0400
  Re: Params -> local vars? Stephen Sprunk <stephen@sprunk.org> - 2012-07-30 15:09 -0500
    Re: Params -> local vars? Mark Bluemel <mark_bluemel@pobox.com> - 2012-07-31 08:34 +0100
      Re: Params -> local vars? Kleuske <kleuske@nowhere.net> - 2012-07-31 19:29 +0000
        Re: Params -> local vars? Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-07-31 15:51 -0400
      Re: Params -> local vars? Kenneth Brody <kenbrody@spamcop.net> - 2012-08-01 15:58 -0400
  Re: Params -> local vars? Keith Thompson <kst-u@mib.org> - 2012-07-30 13:49 -0700
  Re: Params -> local vars? Joe Pfeiffer <pfeiffer@cs.nmsu.edu> - 2012-07-30 21:56 -0600
  Re: Params -> local vars? David T. Ashley <dashley@gmail.com> - 2012-07-31 08:42 -0400
  Re: Params -> local vars? Tim Rentsch <txr@alumni.caltech.edu> - 2012-09-07 13:39 -0700
    Re: Params -> local vars? Keith Thompson <kst-u@mib.org> - 2012-09-07 17:55 -0700
      Re: Params -> local vars? Tim Rentsch <txr@alumni.caltech.edu> - 2012-09-08 05:09 -0700
        Re: Params -> local vars? Keith Thompson <kst-u@mib.org> - 2012-09-08 11:14 -0700
        Re: Params -> local vars? Richard Damon <news.x.richarddamon@xoxy.net> - 2012-09-08 16:43 -0400
          Re: Params -> local vars? Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-17 14:13 -0800

csiph-web