Re: Error: constant false is not an lvalue

2009-08-31 Thread Don
Rainer Deyke wrote: Jarrett Billingsley wrote: "Members are always initialized to the default initializer for their type, which is usually 0 for integer types and NAN for floating point types. This eliminates an entire class of obscure problems that come from neglecting to initialize a member i

Array init

2009-08-31 Thread bearophile
A question about D1 specs (that may be useful for LDC). In the following code there's anarray of structs S. Is it OK, according to D1 specs, to not initialize the memory of this array if the compiler sees that all fields of S have a void init? struct S { double x = void, y = void; } void main()

Re: Error: constant false is not an lvalue

2009-08-31 Thread Steven Schveighoffer
On Sun, 30 Aug 2009 11:25:59 -0400, Ellery Newcomer wrote: Steven Schveighoffer wrote: On Sat, 29 Aug 2009 20:15:55 -0400, Ellery Newcomer wrote: void blah(out bool a = false){ // blah blah blah } compile time use of blah results in error. Am I doing anything wrong? out implies a ref

Re: Error: constant false is not an lvalue

2009-08-31 Thread Manfred_Nowak
Steven Schveighoffer wrote: > What is i referencing when you call: > foo(); Is this an argument for making int j; void foo(ref int i = &j); foo(): legal D? -manfred

Re: Error: constant false is not an lvalue

2009-08-31 Thread Steven Schveighoffer
On Mon, 31 Aug 2009 13:00:34 -0400, Manfred_Nowak wrote: Steven Schveighoffer wrote: What is i referencing when you call: foo(); Is this an argument for making int j; void foo(ref int i = &j); foo(): legal D? No, I'm just trying to explain why having a default value for a ref

Re: Error: constant false is not an lvalue

2009-08-31 Thread Steven Schveighoffer
On Mon, 31 Aug 2009 14:55:43 -0400, Steven Schveighoffer wrote: It's possible that something like what you wrote could work (although I'd write it foo(ref int i = j)). In fact, it does work, in D1 no less. # cat testme.d import tango.io.Stdout; int j; void foo(ref int i = j) { i++;

Any way to workaround Optlink crash?

2009-08-31 Thread Denis Koroskin
I was refactoring the following line of code: foo(rand() % 256); -> foo(0); and that causes Optlink to crash now. Any reason why it does so? That particular file is just 157 lines long, but the whole project is quite big, although there are no large files. The biggest one is ~140K, it's from

Re: Error: constant false is not an lvalue

2009-08-31 Thread Manfred_Nowak
Steven Schveighoffer wrote: > In fact, it does work, in D1 no less. thx ... and another example, that initializing with int.max would serve Walter's intentions better. -manfred

Re: Any way to workaround Optlink crash?

2009-08-31 Thread Tom S
Denis Koroskin wrote: I was refactoring the following line of code: foo(rand() % 256); -> foo(0); and that causes Optlink to crash now. Any reason why it does so? That particular file is just 157 lines long, but the whole project is quite big, although there are no large files. The biggest

Re: problem creating a berkeley db binding

2009-08-31 Thread Mike Parker
JT wrote: i'm trying to create a binding for berkeley db dll and quickly ran into some problems, how do i translate statement below. int DB->open(DB *db, DB_TXN *txnid, const char *file, const char *database, DBTYPE type, u_int32_t flags, int mode); my normal approach would be, extern (C)

closure wonkiness

2009-08-31 Thread Ellery Newcomer
Hello. I have a function that starts off as follows. When peek is called for the first time, f should be -2. It turns out to be garbage. f doesn't get modified anywhere but peek and consume. peek doesn't get called until lexer has returned. This is D 2.031. Is it me or the compiler? public Token

Re: problem creating a berkeley db binding

2009-08-31 Thread JT
Mike Parker Wrote: > JT wrote: > > i'm trying to create a binding for berkeley db dll and quickly ran into > > some problems, how do i translate statement below. > > > > int DB->open(DB *db, DB_TXN *txnid, const char *file, > > const char *database, DBTYPE type, u_int32_t flags, int mode); >

Re: Any way to workaround Optlink crash?

2009-08-31 Thread Max Samukha
Tom S wrote: > > And/or compile some modules without -g. Maybe you don't need debug > symbols everywhere. > > And please vote for http://d.puremagic.com/issues/votes.cgi?action=show_bug&bug_id=424. Something makes Walter think this bug is not critical.