October 17, 2005
Oh my mistake, I thought he was talking about just replacing the printf with a writef. Sorry. I think I need sleep. heh


Unknown W. Brackets wrote:
> No, I think he just means making it so printf has to be imported (like every other C function) which is not the case currently (since it is automatically imported/defined in object.d.)
> 
> -[Unknown]
> 
> 
>> Because they are very different creatures. Just because you have no need for printf doesnt mean you should take it away from me. You are basically talking about 'censoring' portions of the standard c libraries. huh?
October 17, 2005
"Ivan Senji" <ivan.senji_REMOVE_@_THIS__gmail.com> wrote in message news:dj0t1p$pq0$1@digitaldaemon.com...
> JT wrote:
>> No. That would be a Very Bad Idea.
>>
>
> Why? I think it would be a great idea.
I agree
>
>>
>> Oskar Linde wrote:
>>
>>>
>>> Isn't it time to replace printf by writef et.al. as default imported
>>> symbols, or
>>> remove the default import of printf?
>>>
>>> /Oskar
>>>
>>> 


October 17, 2005
JT wrote:
> Oh my mistake, I thought he was talking about just replacing the printf with a writef. Sorry. I think I need sleep. heh
> 

No problem :) The printf has it's place and i agree someone might need it (although in my eyes printf can not compete with writef), but default importing it shouldn't be done.

> 
> Unknown W. Brackets wrote:
> 
>> No, I think he just means making it so printf has to be imported (like every other C function) which is not the case currently (since it is automatically imported/defined in object.d.)
>>
>> -[Unknown]
>>
>>
>>> Because they are very different creatures. Just because you have no need for printf doesnt mean you should take it away from me. You are basically talking about 'censoring' portions of the standard c libraries. huh?
October 18, 2005
In article <dj0g9l$elk$1@digitaldaemon.com>, Walter Bright says...
>
>Use %llu to print a C "long long", which is the equivalent of a D "long". %lu will print a C "long", which is only 32 bits. Or, use std.stdio.writefln(X).

For those who insist on using printf, the C standard does supply a host of pre-done format strings in inttypes.h in an attempt to avoid these mistakes. Probably more useful as a reference than for actual use in a D project, but I've just added them to Ares for the sake of completeness:

http://svn.dsource.org/projects/ares/trunk/src/ares/std/c/inttypes.d


Sean


October 19, 2005
Sean Kelly hat geschrieben:

> In article <dj0g9l$elk$1@digitaldaemon.com>, Walter Bright says...
>>
>>Use %llu to print a C "long long", which is the equivalent of a D "long". %lu will print a C "long", which is only 32 bits. Or, use std.stdio.writefln(X).
> 
> For those who insist on using printf, the C standard does supply a host of pre-done format strings in inttypes.h in an attempt to avoid these mistakes. Probably more useful as a reference than for actual use in a D project, but I've just added them to Ares for the sake of completeness:
> 
> http://svn.dsource.org/projects/ares/trunk/src/ares/std/c/inttypes.d
> 
> 
> Sean

What got me confused in the first place is the fact that the "long long" in
C is simply "long" in D, and I forgot for a second the fact that the D
printf is a wrapper to the C printf, i.e. this function was not rewritten
in D to match the new data types...
Shame on me! :)

Best,
Tiago

-- 
Tiago Gasiba (MSc.) - http://www.gasiba.de
Everything should be made as simple as possible, but not simpler.
October 19, 2005
In article <dj4td4$15lu$1@digitaldaemon.com>, Tiago Gasiba says...
>
>What got me confused in the first place is the fact that the "long long" in
>C is simply "long" in D, and I forgot for a second the fact that the D
>printf is a wrapper to the C printf, i.e. this function was not rewritten
>in D to match the new data types...
>Shame on me! :)

It confuses me too sometimes :)  What helps me remember is that I consider 'int' to be the type in C whose size is most likely to vary, so the standard size-based progression is: char, short, long, long long.  It's just too bad that 'long long' has such an unwieldy name.


Sean


1 2
Next ›   Last »