format a string like sprintf?

2011-08-16 Thread teo
What is the correct way in D to format a string like sprintf? I need to pad a number with zeroes. I tried to use std.format.format and std.string.format, but had some strange results.

Re: format a string like sprintf?

2011-08-16 Thread Steven Schveighoffer
On Tue, 16 Aug 2011 09:23:26 -0400, teo teo.ubu...@yahoo.com wrote: What is the correct way in D to format a string like sprintf? I need to pad a number with zeroes. I tried to use std.format.format and std.string.format, but had some strange results. I think maybe std.string.format? I

Re: format a string like sprintf?

2011-08-16 Thread bearophile
teo: What is the correct way in D to format a string like sprintf? I need to pad a number with zeroes. I tried to use std.format.format and std.string.format, but had some strange results. Why don't you show one or more complete runnable examples that show your strange results? Both if

Re: format a string like sprintf?

2011-08-16 Thread Steven Schveighoffer
On Tue, 16 Aug 2011 09:32:47 -0400, Steven Schveighoffer schvei...@yahoo.com wrote: On Tue, 16 Aug 2011 09:23:26 -0400, teo teo.ubu...@yahoo.com wrote: What is the correct way in D to format a string like sprintf? I need to pad a number with zeroes. I tried to use std.format.format and

Re: format a string like sprintf?

2011-08-16 Thread teo
On Tue, 16 Aug 2011 09:51:41 -0400, bearophile wrote: teo: What is the correct way in D to format a string like sprintf? I need to pad a number with zeroes. I tried to use std.format.format and std.string.format, but had some strange results. Why don't you show one or more complete

Re: how to enable core dumps for assert() triggering?

2011-08-16 Thread Timon Gehr
On 08/16/2011 02:48 AM, mimocrocodil wrote: subj try compiling to 32 bit with the -m32 flag in non-release mode. afaik the 64 bit compiler does not yet support core dumps. (if you are actually compiling to 32 bit then I don't know why you don't get a core dump and you'd have to provide

Re: format a string like sprintf?

2011-08-16 Thread Vijay Nayar
On Tue, 16 Aug 2011 13:23:26 +, teo wrote: What is the correct way in D to format a string like sprintf? I need to pad a number with zeroes. I tried to use std.format.format and std.string.format, but had some strange results. You can go ahead and use the normal std.format to accomplish

Re: how to enable core dumps for assert() triggering?

2011-08-16 Thread mimocrocodil
to Timon Gehr: Thanks! Yes, I am used -m64

Throwing exception in constructor

2011-08-16 Thread Stijn Herreman
Why is the return statement required, while nothing after the Exception is executed? Error: one path skips constructor public this(string p1, string p2, string p3) { string json = download_string(...); if (json is null)

Re: Throwing exception in constructor

2011-08-16 Thread Vijay Nayar
On Tue, 16 Aug 2011 19:08:53 +0200, Stijn Herreman wrote: Why is the return statement required, while nothing after the Exception is executed? Error: one path skips constructor public this(string p1, string p2, string p3) { string json = download_string(...);

Re: Throwing exception in constructor

2011-08-16 Thread Stijn Herreman
On 16/08/2011 19:24, Vijay Nayar wrote: On Tue, 16 Aug 2011 19:08:53 +0200, Stijn Herreman wrote: Why is the return statement required, while nothing after the Exception is executed? Error: one path skips constructor public this(string p1, string p2, string p3) {

Re: Throwing exception in constructor

2011-08-16 Thread Vijay Nayar
On Tue, 16 Aug 2011 19:33:06 +0200, Timon Gehr wrote: On 08/16/2011 07:08 PM, Stijn Herreman wrote: Why is the return statement required, while nothing after the Exception is executed? Error: one path skips constructor public this(string p1, string p2, string p3) { string json =

Re: Throwing exception in constructor

2011-08-16 Thread Stijn Herreman
On 16/08/2011 19:33, Timon Gehr wrote: On 08/16/2011 07:08 PM, Stijn Herreman wrote: Why is the return statement required, while nothing after the Exception is executed? Error: one path skips constructor public this(string p1, string p2, string p3) { string json = download_string(...); if

Re: COFF support for windows compiler

2011-08-16 Thread Timon Gehr
On 08/16/2011 07:53 PM, Klimov Max wrote: Do�developers�plan�to�realize�compilation�to�coff�format�on�windows? There�are�the�cases�when�i�have�to�use�visual�studio�compiler�that generates�coff�object�files.�For�example,�CUDA�compiler�now�support

Insert array into an AA

2011-08-16 Thread nrgyzer
Hi everyone, I've the following: private static ubyte[][2][hash_t] classInstances; this() { classInstances[toHash()] = new ubyte[2]; // does not work } I want insert every class instance into the hashmap. Every class instance should be contained in the map after the constructor was

Re: Insert array into an AA

2011-08-16 Thread Steven Schveighoffer
On Tue, 16 Aug 2011 15:17:33 -0400, nrgyzer nrgy...@gmail.com wrote: Hi everyone, I've the following: private static ubyte[][2][hash_t] classInstances; this() { classInstances[toHash()] = new ubyte[2]; // does not work } I want insert every class instance into the hashmap. Every class

Re: how to enable core dumps for assert() triggering?

2011-08-16 Thread Jonathan M Davis
On Tuesday, August 16, 2011 18:07:45 Timon Gehr wrote: On 08/16/2011 02:48 AM, mimocrocodil wrote: subj try compiling to 32 bit with the -m32 flag in non-release mode. afaik the 64 bit compiler does not yet support core dumps. (if you are actually compiling to 32 bit then I don't know

Re: Insert array into an AA

2011-08-16 Thread Robert Clipsham
On 16/08/2011 20:17, nrgyzer wrote: Hi everyone, I've the following: private static ubyte[][2][hash_t] classInstances; this() { classInstances[toHash()] = new ubyte[2]; // does not work } I want insert every class instance into the hashmap. Every class instance should be contained in

std.format add dash separators to large numbers

2011-08-16 Thread Andrej Mitrovic
Can format do something like this yet? auto str = format(%s, 100); assert(str == 1_000_000); %s would have to be replaced with something else, obviously.

Re: std.format add dash separators to large numbers

2011-08-16 Thread Andrej Mitrovic
I meant underscores not dashes.

Re: std.format add dash separators to large numbers

2011-08-16 Thread bearophile
Andrej Mitrovic: Can format do something like this yet? auto str = format(%s, 100); assert(str == 1_000_000); %s would have to be replaced with something else, obviously. I suggest to add such formatter/function to Phobos. Bye, bearophile

Re: std.format add dash separators to large numbers

2011-08-16 Thread Jouko Koski
bearophile bearophileh...@lycos.com wrote: Andrej Mitrovic: auto str = format(%s, 100); assert(str == 1_000_000); I suggest to add such formatter/function to Phobos. While 1_000_000 may be the right thing in program code, the outside world would probably like to have numbers printed out