🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c
Article #748

Re: variadic min and max, (any some and none, cat and more)

#748
From: Keith Thompson
Date: Sat, 24 Oct 2026 23:34
32 lines
2470 bytes
bartc <bc@freeuk.com> writes:
[...]
> 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.)
[...]

That's an odd and incomplete way to state the rules (and you
missed unions).  See "default argument promotions" in the standard.

A variadic argument of an integer type narrower than int is promoted
to int or unsigned int (int if int holds all possible values of the
source type, otherwise unsigned int).  These "integer promotions"
do not apply to _BitInt types.  A variadic argument of type float is
promoted to double.  All other argument types are not promoted --
though the usual array-to-pointer and function-to-pointer conversions
are applied.

-- 
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
void Void(void) { Void(); } /* The recursive call of the void */
Technical Details
Message-ID: <11bjf9d$35feb$2@kst.eternal-september.org>
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!kst.eternal-september.org!.POSTED!not-for-mail
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> <11bi3bf$2l005$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!kst.eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: variadic min and max, (any some and none, cat and more)
Date: Sat, 24 Oct 2026 16:34:05 -0700
Organization: None to speak of
Lines: 32
Message-ID: <11bjf9d$35feb$2@kst.eternal-september.org>
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>
	<11bi3bf$2l005$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Sat, 24 Oct 2026 23:34:06 +0000 (UTC)
Injection-Info: kst.eternal-september.org;
	logging-data="3325387"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1/1T57X+78BoI/Ohj/dg46o"; posting-host="a31d234860135fde93726068e77d5277"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:o0FQON49WaQo4E2SHENXbDpmMCc= sha256:IheMDbEHUQVm2fH4uUgJ1U2KpEQNjyxHZq/jN/L2P3M=
	sha1:dM1STAXIlD6OyuDRLwGqO4NUkds= sha256:uZvaTtCcjScbdWWmWsK9c9PNQO/sQ+ZA5xWeMqpxoQk=