using scons on 64-bit platform, with gdc

2013-09-18 Thread eles
Hi, Not sure it is a bug or a misuse of scons, but on Saucy 64, with scons --version script: v2.3.0, 2013/03/03 09:48:35, by garyo on reepicheep engine: v2.3.0, 2013/03/03 09:48:35, by garyo on reepicheep and a simple SConstruct like: import os env = Environment(ENV = os.e

Re: this(T...) not called in struct constructor

2013-09-18 Thread Gary Willoughby
On Wednesday, 18 September 2013 at 05:28:41 UTC, Timothee Cour wrote: This may have been discussed before, but I'm not sure whether this is a bug or not. In any case it's a bit confusing. struct Foo2{ this(T...)(T args){ assert(0); } } void main(){ auto a2=Foo2();//doesn't call asser

Re: this(T...) not called in struct constructor

2013-09-18 Thread monarch_dodra
On Wednesday, 18 September 2013 at 05:28:41 UTC, Timothee Cour wrote: This may have been discussed before, but I'm not sure whether this is a bug or not. In any case it's a bit confusing. struct Foo2{ this(T...)(T args){ assert(0); } } void main(){ auto a2=Foo2();//doesn't call asser

Re: I cannot understand problem with argument of the function

2013-09-18 Thread monarch_dodra
On Wednesday, 18 September 2013 at 04:17:41 UTC, mrd wrote: (question is not about function body realisation - body just don't receives right argument value) Looks like data corruption. Can't help you much without a full piece of code that *reproduces* the issue (reducing it helps too). For

Re: I cannot understand problem with argument of the function

2013-09-18 Thread mrd
On Wednesday, 18 September 2013 at 08:25:02 UTC, monarch_dodra wrote: On Wednesday, 18 September 2013 at 04:17:41 UTC, mrd wrote: (question is not about function body realisation - body just don't receives right argument value) Looks like data corruption. Can't help you much without a full pi

Re: I cannot understand problem with argument of the function

2013-09-18 Thread mrd
On Wednesday, 18 September 2013 at 09:07:09 UTC, mrd wrote: Looks like data corruption. Can't help you much without a full piece of code that *reproduces* the issue (reducing it helps too). I will try to do it later. (I tried to copy these functions in a separate file - the problem is not re

Re: I cannot understand problem with argument of the function

2013-09-18 Thread mrd
On Wednesday, 18 September 2013 at 09:09:29 UTC, mrd wrote: On Wednesday, 18 September 2013 at 09:07:09 UTC, mrd wrote: Looks like data corruption. I can not imagine what corruption was going on here: the fact that is contract gets the correct value, but the function itself - not. But they

Re: License of RosettaCode examples (for bearophile:-)

2013-09-18 Thread Joseph Rushton Wakeling
On 17/09/13 16:27, bearophile wrote: Joseph Rushton Wakeling: Well, I guess the best thing would be just to write here, "I license the code under the terms of the Boost license" or something similar (public domain is in some ways less good because not every jurisdiction recognizes it, but as fa

Re: I cannot understand problem with argument of the function

2013-09-18 Thread monarch_dodra
On Wednesday, 18 September 2013 at 09:09:29 UTC, mrd wrote: On Wednesday, 18 September 2013 at 09:07:09 UTC, mrd wrote: Looks like data corruption. Can't help you much without a full piece of code that *reproduces* the issue (reducing it helps too). I will try to do it later. (I tried to cop

Re: I cannot understand problem with argument of the function

2013-09-18 Thread mrd
On Wednesday, 18 September 2013 at 09:56:26 UTC, monarch_dodra wrote: On Wednesday, 18 September 2013 at 09:09:29 UTC, mrd wrote: On Wednesday, 18 September 2013 at 09:07:09 UTC, mrd wrote: Looks like data corruption. Can't help you much without a full piece of code that *reproduces* the issue

Re: License of RosettaCode examples (for bearophile:-)

2013-09-18 Thread Joseph Rushton Wakeling
On 18/09/13 11:55, Joseph Rushton Wakeling wrote: On 17/09/13 16:27, bearophile wrote: Joseph Rushton Wakeling: Well, I guess the best thing would be just to write here, "I license the code under the terms of the Boost license" or something similar (public domain is in some ways less good beca

Re: I cannot understand problem with argument of the function

2013-09-18 Thread monarch_dodra
On Wednesday, 18 September 2013 at 10:37:29 UTC, mrd wrote: Is the contract does not uses its own version of arguments? What is the point of passing earlier changed arguments into contract block? That's a good question. I'll raise it on the main boards.

Re: this(T...) not called in struct constructor

2013-09-18 Thread H. S. Teoh
On Wed, Sep 18, 2013 at 10:12:04AM +0200, monarch_dodra wrote: > On Wednesday, 18 September 2013 at 05:28:41 UTC, Timothee Cour > wrote: > >This may have been discussed before, but I'm not sure whether this is > >a bug or not. In any case it's a bit confusing. > > > >struct Foo2{ > > this(T...)(T

surrounded type modifier

2013-09-18 Thread Namespace
Code: const { /// [1] int a = 3; } void main() { const { /// [2] int b = 4; } } Why is [1] allowed, but not [2]?

Re: surrounded type modifier

2013-09-18 Thread bearophile
Namespace: Code: const { /// [1] int a = 3; } void main() { const { /// [2] int b = 4; } } Why is [1] allowed, but not [2]? Think about what this does: void main() { { int b = 4; } } It creates a new scope inside the functi

Re: using scons on 64-bit platform, with gdc

2013-09-18 Thread eles
On Wednesday, 18 September 2013 at 07:09:27 UTC, eles wrote: import os env = Environment(ENV = os.environ) gcc -o test01 -m32 test01.o -L/usr/lib -lphobos2 -lpthread -lm Related, why the scons is passing the -L/usr/lib to the gcc, while the LD_LIBRARY_PATH variable of my bash shell is rather

Re: surrounded type modifier

2013-09-18 Thread Namespace
Same thing with debug: { // scope code } debug { // debug code }

Re: surrounded type modifier

2013-09-18 Thread Namespace
On Wednesday, 18 September 2013 at 13:42:37 UTC, bearophile wrote: Namespace: Code: const { /// [1] int a = 3; } void main() { const { /// [2] int b = 4; } } Why is [1] allowed, but not [2]? Think about what this does: void main() { {

Re: surrounded type modifier

2013-09-18 Thread Maxim Fomin
On Wednesday, 18 September 2013 at 13:23:10 UTC, Namespace wrote: Code: const { /// [1] int a = 3; } void main() { const { /// [2] int b = 4; } } Why is [1] allowed, but not [2]? Citing grammar: FunctionBody: BlockStatement BodyStatem

Re: surrounded type modifier

2013-09-18 Thread Namespace
On Wednesday, 18 September 2013 at 14:17:04 UTC, Maxim Fomin wrote: On Wednesday, 18 September 2013 at 13:23:10 UTC, Namespace wrote: Code: const { /// [1] int a = 3; } void main() { const { /// [2] int b = 4; } } Why is [1] allowed, but not [2

Re: surrounded type modifier

2013-09-18 Thread Maxim Fomin
On Wednesday, 18 September 2013 at 14:23:25 UTC, Namespace wrote: Should I open an enhancement report? Of course you are always free to open enhancement reports.

Re: GC.collect bug ?

2013-09-18 Thread Dicebot
On Tuesday, 17 September 2013 at 11:14:10 UTC, Temtaime wrote: I cannot use the delete/destroy. I want to call dtor at all unreferenced objects. Manual from Dlang size says that GC.collect triggers a full collection. But it doesn't. It is not possible by design as GC is not deterministic. Des

Re: Odd compiler complaints with import declarations

2013-09-18 Thread Orfeo
Sorry this is correct http://forum.dlang.org/thread/dupcnblrqhesdvwye...@forum.dlang.org

Re: Odd compiler complaints with import declarations

2013-09-18 Thread Orfeo
See also http://forum.dlang.org/thread/dupcnblrqhesdvwyeuaa@forum.dlang.orgOn Friday, 13

Re: I cannot understand problem with argument of the function

2013-09-18 Thread mrd
On Wednesday, 18 September 2013 at 10:59:11 UTC, monarch_dodra wrote: On Wednesday, 18 September 2013 at 10:37:29 UTC, mrd wrote: Is the contract does not uses its own version of arguments? What is the point of passing earlier changed arguments into contract block? That's a good question. I'l

Array length : size_t

2013-09-18 Thread Namespace
D's Array length is currently of type size_t, which means on 32 bit it's an uint and on 64 bit an ulong. This is difficult: What if I want to give the length of an array as parameter to some C functions which accepts only an int? What is the right/safe way to do this? A cast? Or is there someth

Re: I cannot understand problem with argument of the function

2013-09-18 Thread mrd
This bug reproducible also without a template: http://pastebin.com/QPvCFYL1 $ ./bug works: Inside of body: value=1 type=ulong Inside of out contract: value=1 type=ulong result=[1] not works: Inside of body: value=300 type=ulong Inside of out contract: value=2 type=ulong result=[172, 2]

SQLite3 segmentation at prepare statement

2013-09-18 Thread Charles Hixson
I'm trying to use SQLite3 in D, but am getting a segmentation fault when I attempt to replace the exec statement with a prepare statement. What am I doing wrong? If the prepare statement is commented out, and the exec statement is uncommented, the program runs successfully. (There's no data

Re: Array length : size_t

2013-09-18 Thread Dicebot
On Wednesday, 18 September 2013 at 20:46:21 UTC, Namespace wrote: D's Array length is currently of type size_t, which means on 32 bit it's an uint and on 64 bit an ulong. This is difficult: What if I want to give the length of an array as parameter to some C functions which accepts only an int?

Re: Array length : size_t

2013-09-18 Thread H. S. Teoh
On Wed, Sep 18, 2013 at 10:46:18PM +0200, Namespace wrote: > D's Array length is currently of type size_t, which means on 32 bit > it's an uint and on 64 bit an ulong. This is difficult: What if I > want to give the length of an array as parameter to some C functions > which accepts only an int? >

Re: Array length : size_t

2013-09-18 Thread Dicebot
On Wednesday, 18 September 2013 at 22:20:45 UTC, H. S. Teoh wrote: If the C function only accepts int, then just use to!int(array.size). If the size overflows int, to() will throw an exception which you can handle. This is probably the best you can do anyway, since if the C function doesn't tak

Mac and Win support

2013-09-18 Thread Jonathan A Dunlap
In D's current status, which OS between the two would you say is 'most' supported? I'm looking at features like parallelism and SIMD. Thanks!

Re: Array length : size_t

2013-09-18 Thread H. S. Teoh
On Thu, Sep 19, 2013 at 12:52:55AM +0200, Dicebot wrote: > On Wednesday, 18 September 2013 at 22:20:45 UTC, H. S. Teoh wrote: > >If the C function only accepts int, then just use to!int(array.size). > >If the size overflows int, to() will throw an exception which you can > >handle. This is probably

out contract misunderstanding (was: I cannot understand problem with argument of the function)

2013-09-18 Thread mrd
(new topic because old is mired in a long and clumsy source code) import std.stdio; static ubyte func( ulong value ) out( arr ) { writeln( "out contract, value=", value ); } body { writeln( "body, value=", value ); ubyte res; value >>= 7; return res; } void main

dmd segfaults on nested template instantiation (eg A!(A!(int)) )

2013-09-18 Thread Timothee Cour
I just filed a bug report ( http://d.puremagic.com/issues/show_bug.cgi?id=11067) Is there a workaround that keeps same syntax for user code? Use case: i'm generating those from swig(+modifications to map C++ templates to D templates) so I can't factor the template bodies for different template ins

Re: SQLite3 segmentation at prepare statement

2013-09-18 Thread growler
On Wednesday, 18 September 2013 at 21:31:00 UTC, Charles Hixson wrote: I'm trying to use SQLite3 in D, but am getting a segmentation fault when I attempt to replace the exec statement with a prepare statement. What am I doing wrong? If the prepare statement is commented out, and the exec sta

Re: Mac and Win support

2013-09-18 Thread Jacob Carlborg
On 2013-09-19 01:05, Jonathan A Dunlap wrote: In D's current status, which OS between the two would you say is 'most' supported? I'm looking at features like parallelism and SIMD. Thanks! I don't if there are any big differences between Windows and Mac OS X in regards those two features. A b

Re: out contract misunderstanding (was: I cannot understand problem with argument of the function)

2013-09-18 Thread Ivan Kazmenko
On Thursday, 19 September 2013 at 01:41:15 UTC, mrd wrote: $ ./bug body, value=2 out contract, value=0 Why argument "value" in contract isn't equal 2 ? Why should it be? value is a mutable argument, and the out contract evaluates it at the return point, which is after it's set to 0. It is