From: Horst von Brand <vonbrand@inf.utfsm.cl>
To: git@vger.kernel.org
Subject: Re: [PATCH] Trivial warning fix for imap-send.c
Date: Mon, 13 Mar 2006 00:14:33 -0400 [thread overview]
Message-ID: <200603130414.k2D4EXcX011651@laptop11.inf.utfsm.cl> (raw)
In-Reply-To: Message from Jeff King <peff@peff.net> of "Sun, 12 Mar 2006 22:38:05 EST." <20060313033805.GB14601@coredump.intra.peff.net>
Jeff King <peff@peff.net> wrote:
[...]
> A void pointer is guaranteed to be able to hold any type of pointer
> (either char * or struct foo * or whatever). The declaration of malloc
> indicates a return of void *. On a platform where it matters, the
> compiler generates code so that
> struct foo *bar = malloc(100);
> converts the void * pointer into the correct size (in the same way that
> assigning between differently sized integers works).
Right.
> This breaks down with variadic functions, which have no typing
> information. So doing this:
> execl("foo", "bar", my_struct_foo);
> doesn't give the compiler a chance to do the implicit cast and you get
> subtle breakage (in the same way that you would if you passed a long to
> a variadic function expecting a short).
It just passes 3 "void *"'s, and casts back. What is so strange?
--
Dr. Horst H. von Brand User #22616 counter.li.org
Departamento de Informatica Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria +56 32 654239
Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
next prev parent reply other threads:[~2006-03-13 15:49 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-11 19:29 [PATCH] Trivial warning fix for imap-send.c Art Haas
2006-03-12 10:44 ` Mark Wooding
2006-03-12 11:27 ` Junio C Hamano
2006-03-12 13:59 ` [PATCH] Use explicit pointers for execl...() sentinels Mark Wooding
2006-03-12 15:13 ` Timo Hirvonen
2006-03-12 17:32 ` Mark Wooding
2006-03-12 18:08 ` Timo Hirvonen
2006-03-13 3:31 ` Jeff King
2006-03-13 4:12 ` Horst von Brand
2006-03-14 0:42 ` [OT] " Jeff King
2006-03-12 16:57 ` [PATCH] Trivial warning fix for imap-send.c Linus Torvalds
2006-03-12 18:01 ` Mark Wooding
2006-03-12 19:20 ` A Large Angry SCM
2006-03-13 2:59 ` H. Peter Anvin
2006-03-13 4:36 ` A Large Angry SCM
2006-03-13 5:22 ` Linus Torvalds
2006-03-13 6:37 ` H. Peter Anvin
2006-03-13 6:46 ` Linus Torvalds
2006-03-13 16:37 ` Olivier Galibert
2006-03-13 3:38 ` Jeff King
2006-03-13 4:14 ` Horst von Brand [this message]
2006-03-13 16:26 ` Linus Torvalds
2006-03-13 6:41 ` H. Peter Anvin
2006-03-12 21:51 ` Horst von Brand
2006-03-12 23:02 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200603130414.k2D4EXcX011651@laptop11.inf.utfsm.cl \
--to=vonbrand@inf.utfsm.cl \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).