You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Martin Sebor <se...@roguewave.com> on 2007/07/02 21:49:34 UTC
Re: MSVC8 CRT "Secure Template Overloads" feature and stdcxx
Martin Sebor wrote:
> Farid Zaripov wrote:
>>> -----Original Message-----
>>> From: Martin Sebor [mailto:sebor@roguewave.com] Sent: Wednesday, June
>>> 13, 2007 6:24 PM
>>> To: stdcxx-dev@incubator.apache.org
>>> Subject: Re: MSVC8 CRT "Secure Template Overloads" feature and stdcxx
>>>
>>>> Since va_list can be anything, we need to pass va_list type in
>>>> function call.
>>>> We can add function template <class T> get_t () { T t;
>>> return t; } to
>>>> the libc_decl.sh and use the followinf declaration:
>>>> vsprintf((char*)0,0,get_t<va_list>())
>>>> in headers.inc.
>>> Wouldn't vsprintf((char*)0,0,va_list()) work?
>>
>> I think this should work.
>>
>>> My concern here is with the va_list name: Is it required to be
>>> declared in the same header as the functions that use it?
>>
>> On gcc 3.4.4/Cygwin the va_list type is not defined in stdio.h.
>
> Right. The C standard requires that <stdarg.h> be #included
> before calling vsnprintf(). To do what you want you'd need
> to find a way (ideally a general mechanism) to also #include
> <stdarg.h> in these tests.
So what's the status of this improvement? I didn't mean to shoot
it down completely, just point out the problem with it on other
platforms. Since this is an MSVC-specific feature it wouldn't be
completely inappropriate to devise an MSVC-specific solution for
it.
Martin
RE: MSVC8 CRT "Secure Template Overloads" feature and stdcxx
Posted by Farid Zaripov <Fa...@epam.com>.
> -----Original Message-----
> From: Martin Sebor [mailto:sebor@roguewave.com]
> Sent: Monday, July 02, 2007 10:50 PM
> To: stdcxx-dev@incubator.apache.org
> Subject: Re: MSVC8 CRT "Secure Template Overloads" feature and stdcxx
>
> >> On gcc 3.4.4/Cygwin the va_list type is not defined in stdio.h.
> >
> > Right. The C standard requires that <stdarg.h> be #included before
> > calling vsnprintf(). To do what you want you'd need to find a way
> > (ideally a general mechanism) to also #include <stdarg.h> in these
> > tests.
>
> So what's the status of this improvement? I didn't mean to
> shoot it down completely, just point out the problem with it
> on other platforms. Since this is an MSVC-specific feature it
> wouldn't be completely inappropriate to devise an
> MSVC-specific solution for it.
We can extend headers.inc with additional data on headers and types,
i.e.:
# list of headers
hdrs="assert ctype errno float iso646 limits locale math setjmp signal
\
stdarg stddef stdio stdlib string time wchar wctype new typeinfo"
hdrs="$hdrs ieeefp.h pthread.h"
# list of types in header
stdarg_h="va_list"
stddef_h="size_t ptrdiff_t"
And then search and #include header which define the type, used in
function call.
Farid.