From: Andreas Schwab <schwab@suse.de>
To: Jan Engelhardt <jengelh@linux01.gwdg.de>
Cc: Jakub Jelinek <jakub@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: var args in kernel?
Date: Mon, 22 Nov 2004 13:41:07 +0100 [thread overview]
Message-ID: <je3bz2ys2k.fsf@sykes.suse.de> (raw)
In-Reply-To: <Pine.LNX.4.53.0411221235410.29615@yvahk01.tjqt.qr> (Jan Engelhardt's message of "Mon, 22 Nov 2004 12:39:54 +0100 (MET)")
Jan Engelhardt <jengelh@linux01.gwdg.de> writes:
>>> In theory, you can't. But the way how GCC (and probably other compilers)
>>> implement it, you can. Because "ap" is just a pointer (which fits into a
>>> register, if I may add). As such, you can copy it, pass it multiple times, use
>>> it multiple times, and whatever you like.
>>
>>That's exactly the wrong assumption.
>>On some Linux architectures you can, on others you can't.
>>Architectures where va_list is a char or void pointer include e.g.:
>>i386, sparc*, ppc64, ia64
>>Architectures where va_list is something different, usually struct { ... } va_list[1];
>>or something similar:
>>x86_64, ppc32, alpha, s390, s390x
>
> Yeah I originally had that in mind but did not write it out ;)
> What would the struct look like? Because if the following was true, then you
> could also use a pointer:
You left out an important detail:
> int my_printf(const char *fmt, struct { some ints, some char's, whatever } arg)
int my_printf(const char *fmt, struct { some ints, some char's, whatever } arg[1])
which the same as
int my_printf(const char *fmt, struct { some ints, some char's, whatever } *arg)
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
next prev parent reply other threads:[~2004-11-22 12:41 UTC|newest]
Thread overview: 43+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-09 15:49 2.6.10-rc1-mm4 Andrew Morton
2004-11-09 16:11 ` 2.6.10-rc1-mm4 Jens Axboe
2004-11-09 19:53 ` 2.6.10-rc1-mm4 Andrew Morton
2004-11-09 21:14 ` 2.6.10-rc1-mm4 Jens Axboe
2004-11-09 21:57 ` 2.6.10-rc1-mm4 Jens Axboe
2004-11-10 16:28 ` 2.6.10-rc1-mm4 Jens Axboe
2004-11-09 16:32 ` 2.6.10-rc1-mm4 Jesse Barnes
2004-11-09 16:41 ` 2.6.10-rc1-mm4 Markus Trippelsdorf
2004-11-09 21:11 ` [patch] 2.6.10-rc1-mm4: bttv-driver.c compile error Adrian Bunk
2004-11-09 21:43 ` Gerd Knorr
2004-11-09 21:55 ` Markus Trippelsdorf
2004-11-10 8:24 ` Gerd Knorr
2004-11-10 8:47 ` Andrew Morton
2004-11-10 11:19 ` Markus Trippelsdorf
2004-11-18 16:58 ` Gerd Knorr
2004-11-19 11:46 ` Markus Trippelsdorf
[not found] ` <419E689A.5000704@backtobasicsmgmt.com>
2004-11-22 9:43 ` var args in kernel? Gerd Knorr
2004-11-22 10:16 ` Jakub Jelinek
2004-11-22 10:29 ` Gerd Knorr
2004-11-22 11:03 ` Jan Engelhardt
2004-11-22 11:33 ` Jakub Jelinek
2004-11-22 11:39 ` Jan Engelhardt
2004-11-22 12:41 ` Andreas Schwab [this message]
2004-11-22 21:42 ` Bill Davidsen
2004-11-22 23:18 ` Jakub Jelinek
2004-11-22 23:43 ` Andreas Schwab
2004-11-23 14:05 ` Jan Engelhardt
2004-11-23 15:07 ` Andreas Schwab
2004-11-23 16:17 ` Jan Engelhardt
2004-11-23 16:45 ` Andreas Schwab
2004-12-01 22:49 ` Bill Davidsen
2004-12-02 0:26 ` Andreas Schwab
2004-11-09 17:02 ` 2.6.10-rc1-mm4 Stefano Rivoir
2004-11-09 23:18 ` 2.6.10-rc1-mm4 Dave Airlie
2004-11-10 1:30 ` 2.6.10-rc1-mm4 Dave Airlie
2004-11-10 7:44 ` 2.6.10-rc1-mm4 Stefano Rivoir
2004-11-11 7:39 ` 2.6.10-rc1-mm4 Stefano Rivoir
2004-11-09 20:30 ` 2.6.10-rc1-mm4: net/tulip/xircom_tulip_cb.c compile error Adrian Bunk
2004-11-09 21:23 ` [2.6 patch] remove stale bttv_parse prototype Adrian Bunk
2004-11-10 11:40 ` 2.6.10-rc1-mm4 Fabio Coatti
2004-11-10 12:36 ` 2.6.10-rc1-mm4 Rafael J. Wysocki
2004-11-11 10:17 ` 2.6.10-rc1-mm4 Stefano Rivoir
2004-11-11 10:24 ` 2.6.10-rc1-mm4 Andrew Morton
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=je3bz2ys2k.fsf@sykes.suse.de \
--to=schwab@suse.de \
--cc=jakub@redhat.com \
--cc=jengelh@linux01.gwdg.de \
--cc=linux-kernel@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
Powered by JetHome