Prevent default-initialised struct

2009-01-26 Thread Daniel Keep
Hi all, is there any way to prevent a struct from being created directly? Basically, I want to prevent this: { non_null!(T) a; } I want people to have to use provided functions to create a structure: { auto a = non_null!(T)(new T); } -- Daniel

bcdgen and gccxml: detecting parse errors?

2009-01-26 Thread Lutger
When bcdgen parses a header file with errors, it still completes the translation. Is there a way I can get bcdgen to error out? I think it's a gccxml thing, for even while detecting errors it returns 0. The problem is that some projects seem to have header files which are only useful if

Re: bcdgen and gccxml: detecting parse errors?

2009-01-26 Thread Lutger
So it was my error, some modifications I made to bcdgen. Sorry for the noise. * why is it that these dumb mistakes always get apparent at once AFTER posting ...*

Re: bcdgen and gccxml: detecting parse errors?

2009-01-26 Thread John Reimer
Hello lutger, So it was my error, some modifications I made to bcdgen. Sorry for the noise. * why is it that these dumb mistakes always get apparent at once AFTER posting ...* Because the newsgroup version of Murphy's Law is fairly consistant? :D At the very least, knowing this law, we

Re: Prevent default-initialised struct

2009-01-26 Thread Denis Koroskin
On Mon, 26 Jan 2009 20:40:01 +0300, BCS n...@anon.com wrote: Hello Daniel, Hi all, is there any way to prevent a struct from being created directly? Basically, I want to prevent this: { non_null!(T) a; } I want people to have to use provided functions to create a structure: { auto a =

Re: long compile time 2.023 (few lines of code)

2009-01-26 Thread Denis Koroskin
On Tue, 27 Jan 2009 01:08:17 +0300, Saaa em...@needmail.com wrote: Should I report this as a bug? And, how do I do that :) Lol I didn't even check that. Probably because it does compile (and gives a stack overflow at runtime) when you put the allocation within the main. So it still looks

Re: loop through specific class members

2009-01-26 Thread Sergey Gromov
Mon, 26 Jan 2009 04:50:10 + (UTC), BCS wrote: Hello Sergey, foreach() is a runtime construct. It may be *interpreted* at compile-time, but it's interpreted as if it were run time nevertheless. It dynamically changes the value of 'member' variable. OTOH a foreach on a tuple is a

Trick for teasing out static/constness of member in D1?

2009-01-26 Thread Bill Baxter
I'd like to do something like this: static if (AType.length is a static constant ) { const has_static_length = true; } else static if (AType.length exists but it's not a compile-time constant) { const has_static_length = false; } else { // there is no .length at all } Anyone

Re: loop through specific class members

2009-01-26 Thread BCS
Hello Sergey, but this doesn't: template Tuple(T...) { alias T Tuple; } void foo() { foreach (a; Tuple!(a, b, c)) pragma(msg, a); } $ dmd -c test.d test.d(8): Error: string expected for message, not 'a' test.d(8): Error: string expected for message, not 'a' test.d(8): Error: string expected

Re: long compile time 2.023 (few lines of code)

2009-01-26 Thread bearophile
Denis Koroskin: But not for this one, as it won't be fixed because of the said reason. The limit of the linker may not be solved, but I think it's good to add an error message to the compiler for such situation, so the compiler stops compilation immediately with a clean error message and the