🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #708

Re: one calling convention (so callled "the one")

#708
From: fir
Date: Fri, 23 Oct 2026 12:52
47 lines
2928 bytes
David Brown pisze:
> 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.
> 

i was mostly aware the  cdecl and this second one (pascal?) used on win32
- but it is weirdly vague in my brain now


conventions are various but what i say here is which ones ar eproper and 
which are less

(less proper)


two bointers in registers seem to be the base one, but sometimes
indeed it may be few pointers in registers or maybe even by value in 
registers, but the basic one is imo 2 pointers (in/out)
Technical Details
Message-ID: <11bflac$1q8tc$1@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-mail
References: <11betkq$1h43m$1@dont-email.me> <11bf8m1$1jkb5$2@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: fir <profesor.fir@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: one calling convention (so callled "the one")
Date: Fri, 23 Oct 2026 14:52:28 +0200
Organization: A noiseless patient Spider
Lines: 47
Message-ID: <11bflac$1q8tc$1@dont-email.me>
References: <11betkq$1h43m$1@dont-email.me> <11bf8m1$1jkb5$2@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Fri, 23 Oct 2026 12:52:29 +0000 (UTC)
Injection-Info: dont-email.me;
	logging-data="1909676"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX19h+RCNkB5ubuYuRTPSSJopFXiLtza7qxE="; posting-host="43cad3fa7698c2e9be359f2072ea7249"
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101
 Firefox/140.0 SeaMonkey/2.53.24
Cancel-Lock: sha1:hbwr7dcR6NfLyOaKE3o7+PXK/8Y= sha256:g7nXr4KNglKDXtc48b5OBxC6JuXLa+709jbC7CUWsYw=
	sha1:yeamfZwzZLdNK0L2Hn8yWP6MDjM= sha256:Xa1MnOyg5TDbAoUv78HBaUkeBBFWXvfBUBaDW5g3SvU=
In-Reply-To: <11bf8m1$1jkb5$2@dont-email.me>