Deutsch   English   Français   Italiano  
<87frhihk8u.fsf@nosuchdomain.example.com>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail
From: Keith Thompson <Keith.S.Thompson+u@gmail.com>
Newsgroups: comp.lang.c
Subject: Re: Regarding assignment to struct
Date: Mon, 05 May 2025 13:32:01 -0700
Organization: None to speak of
Lines: 20
Message-ID: <87frhihk8u.fsf@nosuchdomain.example.com>
References: <vv338b$16oam$1@dont-email.me> <vv4j9p$33vhj$1@dont-email.me>
	<86plgo7ahu.fsf@linuxsc.com> <vv9hu7$3nomg$1@dont-email.me>
	<87o6w7h2wn.fsf@nosuchdomain.example.com>
	<20250505120331.000015b2@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Date: Mon, 05 May 2025 22:32:01 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ce0368853eba606cbaed4ff885db219e";
	logging-data="1343581"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX1+0hxhLgDC0LPjYVUR4BoAR"
User-Agent: Gnus/5.13 (Gnus v5.13)
Cancel-Lock: sha1:0uzBHPdy1teoL73ZTms5w8EjIis=
	sha1:WkNL/RaUhlmibu0kqjSEgApPM5g=
Bytes: 2054

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.com
void Void(void) { Void(); } /* The recursive call of the void */