[PD-dev] snprintf vs. sprintf_s?

Hans-Christoph Steiner hans at eds.org
Sat Jan 19 03:23:47 CET 2008


On Jan 18, 2008, at 1:44 PM, Martin Peach wrote:

> Miller Puckette wrote:
>> To: Patrice Colet <pat at mamalala.org>
>> CC: pd-dev at iem.at
>> Subject: Re: [PD-dev] snprintf vs. sprintf_s?
>> Date: Fri, 18 Jan 2008 09:51:04 -0800
>>
>> Hmm, so perhaps I really should be using MSW and not _MSC_VER in  
>> the code.
>> As it is now, cygwin will encounter unaliased snprinf() calls,  
>> which might
>> not compile if sprintf_s is provided there instead.
>>
>
> Cygwin gcc compiles snprintf() without errors here. I think  
> sprintf_s is
> unique to Microsoft.

Yeah, cygwin is a complete POSIX layer for Windows, so it provides  
snprintf().  And the MinGW runtime has provided a sane snprintf().    
_MSC_VER is the best bet for sprintf_s, keep the MS weirdness in MS  
land.

.hc


>
> Martin
>
>
>
>
>> M
>>
>> On Fri, Jan 18, 2008 at 06:02:42PM +0100, Patrice Colet wrote:
>>>
>>> Hi Miller,
>>>
>>> Miller Puckette a ?crit :
>>>> Hi Devs,
>>>>
>>>> I found out that .Net apparently doesn't use "snprintf" but has a
>> similar
>>>> function named "sprintf_s".  (A couple of recent patches change
>> "sprintfs"
>>>> to "snprintfs" leading to compile errors in .Net).  I'm thinking of
>> just
>>>> putting the following in s_main.c and s_file.c:
>>>>
>>>> #ifdef MSW
>>>> #define snprinf sprintf_s
>>>> #endif
>>>>
>>>> My question: will this break cygwin or some other non-microsoft
>> compiler
>>>> for Windows?
>>>>
>>>> thanks
>>>> Miller
>>>
>>> this doesn't break compilation on cygwin shell (with -mno-cygwin  
>>> flag)
>>
>> _______________________________________________
>> PD-dev mailing list
>> PD-dev at iem.at
>> http://lists.puredata.info/listinfo/pd-dev
>
>
>
> _______________________________________________
> PD-dev mailing list
> PD-dev at iem.at
> http://lists.puredata.info/listinfo/pd-dev



------------------------------------------------------------------------ 
----

News is what people want to keep hidden and everything else is  
publicity.          - Bill Moyers






More information about the Pd-dev mailing list