Sujet : Re: Regarding assignment to struct
De : Keith.S.Thompson+u (at) *nospam* gmail.com (Keith Thompson)
Groupes : comp.lang.cDate : 05. May 2025, 21:32:01
Autres entêtes
Organisation : None to speak of
Message-ID : <87frhihk8u.fsf@nosuchdomain.example.com>
References : 1 2 3 4 5 6
User-Agent : Gnus/5.13 (Gnus v5.13)
Michael S <
already5chosen@yahoo.com> writes:
On Mon, 05 May 2025 01:34:16 -0700
Keith Thompson <Keith.S.Thompson+u@gmail.com> wrote:
And more obviously, "%p" requires an argument of type void*, not int*.
>
That part of otherwise very good comment is unreasonably pedantic.
I disagree. I suggest it's a bad habit to use "%p" without ensuring,
by a cast if necessary, that the argument is of type void*.
In most implementations, it's likely that all pointers have the same
size and representation and are passed as arguments in the same way,
but getting the types right means one less thing to worry about.
And since the behavior is undefined, a compiler could warn about
it or even generate code with unexpected behavior. Variadic functions
place the burden of using the correct types on the programmer.
-- Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.comvoid Void(void) { Void(); } /* The recursive call of the void */