delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2012/12/21/19:52:32

X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f
X-Recipient: djgpp AT delorie DOT com
X-Authenticated: #27081556
X-Provags-ID: V01U2FsdGVkX1+Bm4YbamyBzyGEsT3/+joDlPYvbzb3hd5YgQx3FT
dVP2oMRJSE/yWr
Message-ID: <50D50440.6020308@gmx.de>
Date: Sat, 22 Dec 2012 01:52:16 +0100
From: Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121025 Thunderbird/16.0.2
MIME-Version: 1.0
To: djgpp AT delorie DOT com
Subject: Re: Question about va_* macros
References: <50D48246 DOT 7010706 AT gmx DOT de> <201212211842 DOT qBLIg6qp028482 AT envy DOT delorie DOT com>
In-Reply-To: <201212211842.qBLIg6qp028482@envy.delorie.com>
X-Y-GMX-Trusted: 0
Reply-To: djgpp AT delorie DOT com

Am 21.12.2012 19:42, schrieb DJ Delorie:

 > You can't rely on a NULL at the end of a va_list.
 >
 > I have seen *many* bugs where a missing explicit NULL in a va call
 > caused problems because there was no terminator.

Disapointing.
The reason why I have asked this is because according to C99 or POSIX
printf and scanf family of functions shall return EINVAL if there are
insufficient arguments.  This makes it necessary to be able to detect
how many arguments are in va_list.  I have single stepped through the
_doscan() code inspecting the content of va_list and the list was always
terminated with a NULL pointer.  I only checked this with gcc472b.
Because I have seen no djgpp specific code that added the list terminator
I have assumed that this was done by gcc and that it could be taken for
granted that the list will always be terminated this way.
I will will look at glibc and cygwin to see how they handle this issue.

Regards,
Juan M. Guerrero

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019