Article View: comp.lang.c
Article #701Re: one calling convention (so callled "the one")
From: David Brown
Date: Fri, 23 Oct 2026 09:16
Date: Fri, 23 Oct 2026 09:16
31 lines
2360 bytes
2360 bytes
On 23/10/2026 08:08, fir wrote:
> from longer time i think if in c should be not one calling convention
> (or mainly the one)
>
> the one is
>
> ( output* out) foo(input* in)
> {
>
> }
>
> i mean all argument should be passed by one pointer,
> not passed by stack it should be passed by register,
> same as to output - all values should be returned by
> outupu pointer also by register
>
For most calling conventions, "in" would be passed in a register and
"out" returned in a register. The details are from the platform ABI,
and are not relevant to the C language.
And if you want your inputs and outputs to be structs, you can already
do that in C. If these structs are under a certain size (determined by
the ABI), they are typically passed and returned directly in registers -
if they are bigger, they are passed using pointers to structs. (The
caller makes the struct for the parameter, and space for the return struct.)
You might like to try using godbolt.org and looking at the generated
assembly to see what code is actually generated.
Technical Details
Message-ID:
<11bf8m1$1jkb5$2@dont-email.me>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mailReferences:
<11betkq$1h43m$1@dont-email.me>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!eternal-september.org!feeder.eternal-september.org!nntp.eternal-september.org!.POSTED!not-for-mail From: David Brown <david.brown@hesbynett.no> Newsgroups: comp.lang.c Subject: Re: one calling convention (so callled "the one") Date: Fri, 23 Oct 2026 11:16:49 +0200 Organization: A noiseless patient Spider Lines: 31 Message-ID: <11bf8m1$1jkb5$2@dont-email.me> References: <11betkq$1h43m$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Fri, 23 Oct 2026 09:16:50 +0000 (UTC) Injection-Info: dont-email.me; logging-data="1692005"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18VrvUGZC/rDlCkA6tldoiBSpepkBDJauE="; posting-host="7400fcdb32ce88f15c58e9bcb96ebcf6" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:oiLqgG9vx3NzvRJmZj5JfJHaOiI= sha256:6xMXEv40qdjB+Pnpfquc2XX6hU/pevhdt/wJMBivaxY= sha1:28C4shNrEf6uoFIDLxtLT2Ooe88= sha256:yoFnv2eb4UCqwGAYrCxydN/NSoKPBhtibngFdoIcB1k= In-Reply-To: <11betkq$1h43m$1@dont-email.me> Content-Language: en-GB, nb-NO