Article View: comp.lang.c
Article #734Re: variadic min and max, (any some and none, cat and more)
From: bartc
Date: Sat, 24 Oct 2026 11:04
Date: Sat, 24 Oct 2026 11:04
44 lines
2846 bytes
2846 bytes
On 24/10/2026 11:37, chine.bleu wrote: > bartc wrote: >> For this purpose, where all elements are expected to be the same type, >> then passing a list is more appropriate, and more type-safe. Especially >> when 'min_func' has a specific return type anyway. > > In general the function argument types might not be known. So you're talking about variadic functions as they are now? My comment was about a different kind of variadic function with variable-length argument lists but of a common type, known at compile-time. > An actual > argument list might have 1 byte argument, a 17 byte argument, a 4 byte > argument, 128 byte argument. Still talking about variadic functions? Then in C it's more restricted: variadic arguments will be, or be promoted to, one of: * Integer (typically one of i32 u32 i64 u64) * Float (typically f64) * Pointer * Struct The last is more variable, but on modern ABIs, a struct that isn't one of certain set of patterns will be passed by pointer. (I don't know how _BitInt are handled.) > In languages and environments where the > type of each argument is declared, calls can pass arguments with > specialised protocols. So now this is about regular functions? Then there isn't an issue; just follow the ABI if functions may be shared across FFIs or separately compiled C code. But for static functions, a compiler can use any scheme it likes. Or in some cases, use no scheme at all because it inlines calls.
Technical Details
Message-ID:
<11bi3bf$2l005$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-mailReferences:
<11bes8b$1gncr$1@dont-email.me> <11bf84v$1jkb5$1@dont-email.me> <11bfdcs$1mvrv$1@dont-email.me> <11bi1pg$2ke58$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: bartc <bc@freeuk.com> Newsgroups: comp.lang.c Subject: Re: variadic min and max, (any some and none, cat and more) Date: Sat, 24 Oct 2026 12:04:16 +0100 Organization: A noiseless patient Spider Lines: 44 Message-ID: <11bi3bf$2l005$1@dont-email.me> References: <11bes8b$1gncr$1@dont-email.me> <11bf84v$1jkb5$1@dont-email.me> <11bfdcs$1mvrv$1@dont-email.me> <11bi1pg$2ke58$2@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Sat, 24 Oct 2026 11:04:16 +0000 (UTC) Injection-Info: dont-email.me; logging-data="2785285"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+IeYC7rrswcQGMuDW92j4F"; posting-host="f782badb72f356698598d4182f8e6bf9" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:F8KdCZL5C2aEtDaiAUJas+iFQng= sha256:7Bvtno1fqPgA1dexkz57wr9knfW6T/WHMApvQU69PnI= sha1:8P/yKx07AwA3vEL1iXoByicEI60= sha256:D/kIL64K35pQM9FA8NWdsiUr7qTATvrD4rhu52D6ufw= In-Reply-To: <11bi1pg$2ke58$2@dont-email.me> Content-Language: en-GB