The more interesting question

Alex Rønne Petersen alex at lycus.org
Wed May 16 17:03:54 PDT 2012


On 16-05-2012 00:20, deadalnix wrote:
> Le 15/05/2012 21:57, Andrew Wiley a écrit :
>> On Tue, May 15, 2012 at 11:46 AM, deadalnix <deadalnix at gmail.com
>> <mailto:deadalnix at gmail.com>> wrote:
>>
>> Le 15/05/2012 18:19, Gor Gyolchanyan a écrit :
>>
>>
>>
>> On Tue, May 15, 2012 at 7:51 PM, Christophe
>> <travert at phare.normalesup.org
>> <mailto:travert at phare.normalesup.org>
>> <mailto:travert at phare.__normalesup.org
>> <mailto:travert at phare.normalesup.org>>> wrote:
>>
>> using printf will lead to a bug each time the programmer
>> forget the
>> trailing
>> \0.
>>
>>
>> First of all, printf shouldn't be used! There's writef and it's
>> superior
>> to printf in any way!
>> Second of all, if the zero-termination of literals are to be
>> removed,
>> the literals will no longer be accepted as a pointer to a character.
>> The appropriate type mismatch error will force the user to use
>> toUTF8z
>> to get ht e zero-terminated utf-8 version of the original string.
>> In case it's a literal, one could use the compile-time version of
>> toUTF8z to avoid run-time overhead.
>> This all doesn't sound like a bad idea to me. I don't see any
>> security
>> or performance flaws in this scheme.
>> --
>> Bye,
>> Gor Gyolchanyan.
>>
>>
>> May god ear you !
>>
>>
>> Unfortunately, using writef/writefln would make DRuntime depend on
>> Phobos, which is unacceptable.
>>
>
> druntime isn't supposed to printf stuff.

It's called debugging. ;)

-- 
Alex Rønne Petersen
alex at lycus.org
http://lycus.org


More information about the Digitalmars-d mailing list