Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

We are MicroSoft. You will be assimilated. Resistance is futile. (Attributed to B.G., Gill Bates)


devel / comp.std.c / Function calls

SubjectAuthor
* Function callsStefan Ram
+* Re: Function callsStefan Ram
|`- Re: Function callsKaz Kylheku
+- Re: Function callsKaz Kylheku
+* Re: Function callsTim Rentsch
|`* Re: Function callsJames Kuyper
| `* Re: Function callsTim Rentsch
|  `* Re: Function callsJames Kuyper
|   `- Re: Function callsTim Rentsch
`- Re: Function callsStefan Ram

1
Function calls

<calls-20231004163135@ram.dialup.fu-berlin.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=594&group=comp.std.c#594

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram...@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.std.c
Subject: Function calls
Date: 4 Oct 2023 15:59:54 GMT
Organization: Stefan Ram
Lines: 11
Expires: 1 Sep 2024 11:59:58 GMT
Message-ID: <calls-20231004163135@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de 8Rv69RXagwENN1mIvey6+gHucQM8xgWSf9LWwrFohtzz7g
Cancel-Lock: sha1:+OoUr+3IaS/twXj/vNPIbSNXhz0= sha256:q7sSzj5ksKchpfnv6ASXRXlIhBFw/RXxkxZ/LlcHIU0=
X-Copyright: (C) Copyright 2023 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE-1901, en-US, it, fr-FR
 by: Stefan Ram - Wed, 4 Oct 2023 15:59 UTC

A recent draft of the C specification says about "return":

|A return statement terminates execution of the current
|function and returns control to its caller.

. There's also a section "Function calls" in a recent draft.
I expect that this section says something similar, to the effect that
during the evaluation of a function call, control is transferred to
the called function, but I was not able to find such wording!

Re: Function calls

<call-20231004185102@ram.dialup.fu-berlin.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=595&group=comp.std.c#595

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram...@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.std.c
Subject: Re: Function calls
Date: 4 Oct 2023 17:52:11 GMT
Organization: Stefan Ram
Lines: 21
Expires: 1 Sep 2024 11:59:58 GMT
Message-ID: <call-20231004185102@ram.dialup.fu-berlin.de>
References: <calls-20231004163135@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de dSdepYrs6YVq9aub4sS5OweEvXzWm8/T4o/q1BYMPxBsU6
Cancel-Lock: sha1:U2A5sP76Lg/Xd54rw6wTrlBLUrg= sha256:uwsvun+kKWpIZV9lEhb8Xg8AEy6fqcoqRkFZTFWqgLs=
X-Copyright: (C) Copyright 2023 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE-1901, en-US, it, fr-FR
 by: Stefan Ram - Wed, 4 Oct 2023 17:52 UTC

ram@zedat.fu-berlin.de (Stefan Ram) writes:
>. There's also a section "Function calls" in a recent draft.
>I expect that this section says something similar, to the effect that
>during the evaluation of a function call, control is transferred to
>the called function, but I was not able to find such wording!

Now, some might say that C references "ISO/IEC 2382:2015,
Information technology — Vocabulary" which defines "call".
But this (at least in the second edition) defines a "call"
to be an /instruction/, not a runtime event.

The C specification uses the wording "before the actual call",
which wording requires a call to be a runtime event.

So, although "ISO/IEC 2382" then (in its second edition)
explains that a call is an instruction to "transfer control
from one module to another" it does not blend in well -
and it still does not tell us from which "module" to which
"module" control is transfered in the case of a call in C.

Re: Function calls

<20231004111520.709@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=596&group=comp.std.c#596

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.std.c
Subject: Re: Function calls
Date: Wed, 4 Oct 2023 18:38:36 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 29
Message-ID: <20231004111520.709@kylheku.com>
References: <calls-20231004163135@ram.dialup.fu-berlin.de>
Injection-Date: Wed, 4 Oct 2023 18:38:36 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2c3a3ba67029d1579f03d8d04ca3b86b";
logging-data="485051"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+KkoVDjLap5WvGXKOxd2pTqGVXpNJmEjI="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:FQhOs/KsdZ0OBmSpr0qeYTs6ZmM=
 by: Kaz Kylheku - Wed, 4 Oct 2023 18:38 UTC

On 2023-10-04, Stefan Ram <ram@zedat.fu-berlin.de> wrote:
> A recent draft of the C specification says about "return":
>
>|A return statement terminates execution of the current
>|function and returns control to its caller.
>
> . There's also a section "Function calls" in a recent draft.
> I expect that this section says something similar, to the effect that
> during the evaluation of a function call, control is transferred to
> the called function, but I was not able to find such wording!

6.2.4 Storage duration of objects, paragraph 6, has:

(Entering an enclosed block or calling a function suspends, but does not
end, execution of the current block.)

The parentheses likely acknowledge that the requirement doesn't
belong in a section about storage duration.

It doesn't seem to be repeated anywhere else. It is not defined what
"entering" means.

ISO 2382-1 itself uses "enter" in multiple places without defining it.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: Function calls

<20231004113839.724@kylheku.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=597&group=comp.std.c#597

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 864-117-...@kylheku.com (Kaz Kylheku)
Newsgroups: comp.std.c
Subject: Re: Function calls
Date: Wed, 4 Oct 2023 18:41:45 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <20231004113839.724@kylheku.com>
References: <calls-20231004163135@ram.dialup.fu-berlin.de>
<call-20231004185102@ram.dialup.fu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Date: Wed, 4 Oct 2023 18:41:45 -0000 (UTC)
Injection-Info: dont-email.me; posting-host="2c3a3ba67029d1579f03d8d04ca3b86b";
logging-data="485051"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/aFeLLeHG9XolJ96gfkDVUaJp4PqHSCcY="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:iiMpPBIRkCxbHolm8LCCK/L3h4o=
 by: Kaz Kylheku - Wed, 4 Oct 2023 18:41 UTC

On 2023-10-04, Stefan Ram <ram@zedat.fu-berlin.de> wrote:
> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>>. There's also a section "Function calls" in a recent draft.
>>I expect that this section says something similar, to the effect that
>>during the evaluation of a function call, control is transferred to
>>the called function, but I was not able to find such wording!
>
> Now, some might say that C references "ISO/IEC 2382:2015,
> Information technology — Vocabulary" which defines "call".
> But this (at least in the second edition) defines a "call"
> to be an /instruction/, not a runtime event.

In my opinion, ISO 2382 is bunk. Its definitions are comically
primitive; it's like some sixth grader's computer blog.

ISO C should beef up its definitions section and stop referring to that
useless, embarassing document.

Sample of the amateuris drivel:

block diagram

A diagram of a system in which the principal
parts or functions are represented by blocks
connected by lines that show the relationships
of the blocks.

Wow, really.

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca
NOTE: If you use Google Groups, I don't see you, unless you're whitelisted.

Re: Function calls

<86bkdddd20.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=598&group=comp.std.c#598

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.std.c
Subject: Re: Function calls
Date: Wed, 04 Oct 2023 19:21:27 -0700
Organization: A noiseless patient Spider
Lines: 20
Message-ID: <86bkdddd20.fsf@linuxsc.com>
References: <calls-20231004163135@ram.dialup.fu-berlin.de>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="a39e5ee1c6dfe7b41e0e8f641c3ae6d1";
logging-data="788311"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/jbNaF9w0ySKg0cLi4YpI/fNFDLZQoXA4="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:mp1zEmbditPEfR2K0/xCFuvSHJQ=
sha1:86wpVc4uNeNJujNotaM/4Dg6ZvQ=
 by: Tim Rentsch - Thu, 5 Oct 2023 02:21 UTC

ram@zedat.fu-berlin.de (Stefan Ram) writes:

> A recent draft of the C specification says about "return":
>
> |A return statement terminates execution of the current
> |function and returns control to its caller.
>
> . There's also a section "Function calls" in a recent draft.
> I expect that this section says something similar, to the effect that
> during the evaluation of a function call, control is transferred to
> the called function, but I was not able to find such wording!

AFAICT the C standard does not say explicitly that a function
call gives or transfers control to the function being called.
It has been pointed out that the standard does say that calling
a function suspends execution of the current block.

Considering those facts, do you think there is a problem with
the current wording used in the standard? If you do, what
would you say the problem is, and why is it a problem?

Re: Function calls

<dff9aa5c-bb01-48e8-8793-79af97775a5dn@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=599&group=comp.std.c#599

  copy link   Newsgroups: comp.std.c
X-Received: by 2002:a05:620a:14f:b0:775:810b:2ec with SMTP id e15-20020a05620a014f00b00775810b02ecmr98469qkn.1.1696564204918;
Thu, 05 Oct 2023 20:50:04 -0700 (PDT)
X-Received: by 2002:a05:6808:1995:b0:3ad:f3e6:66fe with SMTP id
bj21-20020a056808199500b003adf3e666femr3773679oib.4.1696564204609; Thu, 05
Oct 2023 20:50:04 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.std.c
Date: Thu, 5 Oct 2023 20:50:04 -0700 (PDT)
In-Reply-To: <86bkdddd20.fsf@linuxsc.com>
Injection-Info: google-groups.googlegroups.com; posting-host=108.45.179.220; posting-account=Ix1u_AoAAAAILVQeRkP2ENwli-Uv6vO8
NNTP-Posting-Host: 108.45.179.220
References: <calls-20231004163135@ram.dialup.fu-berlin.de> <86bkdddd20.fsf@linuxsc.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <dff9aa5c-bb01-48e8-8793-79af97775a5dn@googlegroups.com>
Subject: Re: Function calls
From: jameskuy...@alumni.caltech.edu (James Kuyper)
Injection-Date: Fri, 06 Oct 2023 03:50:04 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: James Kuyper - Fri, 6 Oct 2023 03:50 UTC

On Wednesday, October 4, 2023 at 10:21:30 PM UTC-4, Tim Rentsch wrote:
> r...@zedat.fu-berlin.de (Stefan Ram) writes:
>
> > A recent draft of the C specification says about "return":
> >
> > |A return statement terminates execution of the current
> > |function and returns control to its caller.
> >
> > . There's also a section "Function calls" in a recent draft.
> > I expect that this section says something similar, to the effect that
> > during the evaluation of a function call, control is transferred to
> > the called function, but I was not able to find such wording!
> 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).

Re: Function calls

<Java-20231006095310@ram.dialup.fu-berlin.de>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=600&group=comp.std.c#600

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram...@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.std.c
Subject: Re: Function calls
Date: 6 Oct 2023 08:54:37 GMT
Organization: Stefan Ram
Lines: 14
Expires: 1 Sep 2024 11:59:58 GMT
Message-ID: <Java-20231006095310@ram.dialup.fu-berlin.de>
References: <calls-20231004163135@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de 6lcU9Kn+9nUOIBrV0ftZtA05MvOHJBTxLfOFOOP51czxOl
Cancel-Lock: sha1:W58at2m9pwunwiZeJ1PbQ5OBvgQ= sha256:gHPnfkp1xl9cDSBVqYOMU1UJIk53/106EKh2eKyPoak=
X-Copyright: (C) Copyright 2023 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Accept-Language: de-DE-1901, en-US, it, fr-FR
 by: Stefan Ram - Fri, 6 Oct 2023 08:54 UTC

ram@zedat.fu-berlin.de (Stefan Ram) writes:
>during the evaluation of a function call, control is transferred to
>the called function, but I was not able to find such wording!

Here is an example from a Java specification
(Java SE 18 Edition):

|15.12.4 Run-Time Evaluation of Method Invocation
....
|and control is transferred to the method code.

.

Re: Function calls

<865y3kc4et.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=601&group=comp.std.c#601

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.std.c
Subject: Re: Function calls
Date: Fri, 06 Oct 2023 05:38:02 -0700
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <865y3kc4et.fsf@linuxsc.com>
References: <calls-20231004163135@ram.dialup.fu-berlin.de> <86bkdddd20.fsf@linuxsc.com> <dff9aa5c-bb01-48e8-8793-79af97775a5dn@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="0d66ad153fa8b33d210641d1146ceacc";
logging-data="1634076"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19hpoXxBXCN4ybN+l5Flnftu5IlSf6I9BY="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:I2SrXJV5lUSWlbqxpmgA/iHNiaM=
sha1:O3xUVT2lQ9zsQso3N+tpTNbSVmk=
 by: Tim Rentsch - Fri, 6 Oct 2023 12:38 UTC

James Kuyper <jameskuyper@alumni.caltech.edu> writes:

> On Wednesday, October 4, 2023 at 10:21:30?PM UTC-4, Tim Rentsch wrote:
>
>> r...@zedat.fu-berlin.de (Stefan Ram) writes:
>>
>>> A recent draft of the C specification says about "return":
>>>
>>> |A return statement terminates execution of the current
>>> |function and returns control to its caller.
>>>
>>> . There's also a section "Function calls" in a recent draft.
>>> I expect that this section says something similar, to the effect that
>>> during the evaluation of a function call, control is transferred to
>>> the called function, but I was not able to find such wording!
>>
>> 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.)

What we are looking for is something that says the function is
"entered", that is, that control is transferred. It appears the
C standard doesn't actually say that. In section 6.5.2.2, which
describes function call expressions, the standard doesn't even
explicitly say that a function call expression will call the
function. The word "call" is used often in 6.5.2.2, but always
as a noun, never a verb. So 6.5.2.2 says a lot about function
calls, but never explicitly says that one takes place.

I expect no one is confused or unsure about what semantics are
intended for a function call expression. The question being
asked is about whether the C standard does or should say that a
transfer of control takes place (and if so, how explicitly).
AFAICT the C standard makes no explicit statement that a function
call expression causes a transfer of control, i.e., that at
runtime the called function is "entered". What text in the
standard says that a function call expression causes a transfer
of control to take place? Or isn't there one?

Re: Function calls

<97fa4405-e88f-4984-a81b-af86c64dedc3n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=602&group=comp.std.c#602

  copy link   Newsgroups: comp.std.c
X-Received: by 2002:a05:6214:a8e:b0:64a:15a0:8c97 with SMTP id ev14-20020a0562140a8e00b0064a15a08c97mr132503qvb.11.1696640657159;
Fri, 06 Oct 2023 18:04:17 -0700 (PDT)
X-Received: by 2002:a05:6808:18aa:b0:3a7:805:f419 with SMTP id
bi42-20020a05680818aa00b003a70805f419mr5014159oib.6.1696640656869; Fri, 06
Oct 2023 18:04:16 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!proxad.net!feeder1-2.proxad.net!209.85.160.216.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.std.c
Date: Fri, 6 Oct 2023 18:04:16 -0700 (PDT)
In-Reply-To: <865y3kc4et.fsf@linuxsc.com>
Injection-Info: google-groups.googlegroups.com; posting-host=108.45.179.220; posting-account=Ix1u_AoAAAAILVQeRkP2ENwli-Uv6vO8
NNTP-Posting-Host: 108.45.179.220
References: <calls-20231004163135@ram.dialup.fu-berlin.de> <86bkdddd20.fsf@linuxsc.com>
<dff9aa5c-bb01-48e8-8793-79af97775a5dn@googlegroups.com> <865y3kc4et.fsf@linuxsc.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <97fa4405-e88f-4984-a81b-af86c64dedc3n@googlegroups.com>
Subject: Re: Function calls
From: jameskuy...@alumni.caltech.edu (James Kuyper)
Injection-Date: Sat, 07 Oct 2023 01:04:17 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: James Kuyper - Sat, 7 Oct 2023 01:04 UTC

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.

Re: Function calls

<86wmvwbvc8.fsf@linuxsc.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=603&group=comp.std.c#603

  copy link   Newsgroups: comp.std.c
Path: i2pn2.org!i2pn.org!eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: tr.17...@z991.linuxsc.com (Tim Rentsch)
Newsgroups: comp.std.c
Subject: Re: Function calls
Date: Sun, 08 Oct 2023 15:30:47 -0700
Organization: A noiseless patient Spider
Lines: 108
Message-ID: <86wmvwbvc8.fsf@linuxsc.com>
References: <calls-20231004163135@ram.dialup.fu-berlin.de> <86bkdddd20.fsf@linuxsc.com> <dff9aa5c-bb01-48e8-8793-79af97775a5dn@googlegroups.com> <865y3kc4et.fsf@linuxsc.com> <97fa4405-e88f-4984-a81b-af86c64dedc3n@googlegroups.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Info: dont-email.me; posting-host="5915bdb212e2b0e987e45f261a72d332";
logging-data="3539152"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+210QhUD635coOpnOed3ZxpM48EMYTI+k="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:ra7L5jAarkiUw59q2ctRUZ30GwE=
sha1:g+P3JZId42y2FdIdlDZwrTVmRWE=
 by: Tim Rentsch - Sun, 8 Oct 2023 22:30 UTC

James Kuyper <jameskuyper@alumni.caltech.edu> writes:

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

Specificaly, paragraphs 10, 11, and 12 give the semantics for when
a function definition is elaborated. Note that the Standard does
not say that these paragraphs are about what happens when the
function is called, but what happens when the function is entered.
It may be that the intention is to say what happens when the
function is called, but the Standard doesn't say that. Paragraph 10
starts "On entry ..."; it does not say "On being 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.

I never said I think that. My guess is you didn't give full
attention to the second paragraph of my first posting (and which
you left out of your reply), which makes clear that I am asking
questions of the OP, and not stating a position of my own. I
don't have a dog in this fight.

> The standard specifies that the compound statement that
> constitutes the body of the function gets executed.

No, it doesn't. What the Standard does say is that the function
body (i.e., the compound statement that constitutes the body
thereof) gets executed /if and when the function is entered/.
No entry, no execution. The issue is Does the Standard say the
function is entered (or called)? Apparently the Standard does
not explicitly say that.

Note that every other state-changing construct (or at least those I
could think of: ++, --, assignment, if(), switch(), for(), do,
while(), goto, break, continue, and most notably return) describe
their semantics using a transitive verb (sometimes using the passive
voice, but a transitive verb nonetheless). The semantic description
of function call expressions does not use any such constructions for
the action of calling the function (although there are several
transitive verbs for actions that take place /before/ calling the
function). Because the description of return says "A return
statement terminates execution of the current function and returns
control to its caller", it isn't surprising that some people expect
to find some sort of similar wording about transferring control in
the description of semantics for function call expressions (and in
particular the OP did have such an expectation). But there isn't
any.

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

This question is moot because it starts from a false assumption.

> To me, execution of the compound statement is what I want to have
> happen.

The question under discussion is about what the C standard says,
not about what anyone wants or expects. Everyone, or at least
every C programmer, expects and wants a function body to be
executed when a function call expression is evaluated - there is
no disagreement about that.

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

If you get to a point where a conversation doesn't make sense, you
might want to go back and take another look at earlier comments,
to see if there is a point where assumptions on the two sides
diverged, either because someone didn't understand what the other
party was saying or because what someone was trying to say wasn't
said very well and may have been misinterpreted. If that has
happened it's unlikely any progress will be made until the
divergence has been identified and somehow reconciled.

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor