Groups | Search | Server Info | Login | Register


Groups > comp.std.c > #6583

Re: Function calls

Newsgroups comp.std.c
Date 2023-10-06 18:04 -0700
References <calls-20231004163135@ram.dialup.fu-berlin.de> <86bkdddd20.fsf@linuxsc.com> <dff9aa5c-bb01-48e8-8793-79af97775a5dn@googlegroups.com> <865y3kc4et.fsf@linuxsc.com>
Message-ID <97fa4405-e88f-4984-a81b-af86c64dedc3n@googlegroups.com> (permalink)
Subject Re: Function calls
From James Kuyper <jameskuyper@alumni.caltech.edu>

Show all headers | View raw


On Friday, October 6, 2023 at 8:38:10 AM UTC-4, Tim Rentsch wrote:
> James Kuyper <james...@alumni.caltech.edu> writes:
> > On Wednesday, October 4, 2023 at 10:21:30?PM UTC-4, Tim Rentsch wrote: 
...
> >> AFAICT the C standard does not say explicitly that a function 
> >> call gives or transfers control to the function being called. 
> > 
> > Section 6.9.1 is about function definitions,. while 6.5.2.2 is 
> > about function calls, but 6.9.1 has several paragraphs of 
> > specification about what happens when the function is called, and 
> > the relevant one is: 
> > 
> > "After all parameters have been assigned, the compound statement 
> > that constitutes the body of the function definition is executed." 
> > (6.9.1p11).
> That is one relevant paragraph, but not the only relevant paragraph. 
> Paragraph 10 of that section says 
> 
> On entry to the function, the size expressions of each variably 
> modified parameter are evaluated and the value of each argument 
> expression is converted to the type of the corresponding 
> parameter as if by assignment. (Array expressions and function 
> designators as arguments were converted to pointers before the 
> call.) 

Yes, I mentioned that - "several paragraphs of specification about
what happens when the function is called".

> What we are looking for is something that says the function is 
> "entered", that is, that control is transferred.

I find it confusing that you think something more needs to be
specified. The standard specifies that the compound statement
that constitutes the body of the function gets executed. Could you
explain how that differs from having control transferred to the
function? Please give an example of what it would mean to have
the compound statement executed without transferring control. To
me, execution of the compound statement is what I want to have
happen. It may be a failure of my imagination, but I can't imagine
what it would mean for that to happen without transferring control,
but if it could, I also can't imagine caring.

Back to comp.std.c | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Re: Function calls Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-10-04 19:21 -0700
  Re: Function calls James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-10-05 20:50 -0700
    Re: Function calls Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-10-06 05:38 -0700
      Re: Function calls James Kuyper <jameskuyper@alumni.caltech.edu> - 2023-10-06 18:04 -0700
        Re: Function calls Tim Rentsch <tr.17687@z991.linuxsc.com> - 2023-10-08 15:30 -0700

csiph-web