Re: Loop through all modules and module members?

2011-01-02 Thread Philippe Sigaud
On Sat, Jan 1, 2011 at 18:56, Andrej Mitrovic andrej.mitrov...@gmail.com wrote: On 1/1/11, Philippe Sigaud philippe.sig...@gmail.com wrote: I'm not sure it's doable at compile-time right now: you need to have access to the module code, as text. Do imports work in CT-evaluable functions?

Re: dmd compile with imported modules

2011-01-02 Thread useo
rdmd has some problems with my lib-files. Instead of rdmd I just tried xfbuild and it works great on windows, but as I can see there is no linux 32 bit version which I would like to use?!

Re: cstrings

2011-01-02 Thread Jonathan M Davis
On Saturday 01 January 2011 20:12:31 Ellery Newcomer wrote: are there any other cstring - dstring functions than to!string(char*) ? something like to!(char[])(char*) (the memory allocation bothers me) to!(char[])() should work just fine, but I believe that you're going to have to have a

Re: cstrings

2011-01-02 Thread Mafi
Am 02.01.2011 05:12, schrieb Ellery Newcomer: are there any other cstring - dstring functions than to!string(char*) ? something like to!(char[])(char*) (the memory allocation bothers me) You can simply make a slice. Indexing and sclicing works also with c-style pointers in D. Obviously $ is

Re: void main returning int - why compiles?

2011-01-02 Thread bearophile
Manfred Nowak: | Expression is allowed even if the function specifies a void return | type. The Expression will be evaluated, but nothing will be returned. | If the Expression has no side effects, and the return type is void, | then it is illegal.

Re: Loop through all modules and module members?

2011-01-02 Thread Andrej Mitrovic
On 1/2/11, Philippe Sigaud philippe.sig...@gmail.com wrote: Of course, you need to -J switch with the path of your module. I'm not much versed in DMD switches. I'll try and see. Philippe Well it's a simple switch, really. If the module is in C:\dev\project\, use: dmd -JC:\dev\project\ On

Re: sizeof

2011-01-02 Thread Manfred_Nowak
Ellery Newcomer wrote: prints 12, DMD 2.051 linux So we have: ( linux32 , dmd 2.051) - 12 ( linux32 , gdc) - 12 ( linux64 , gdc) - 12 ( linux64 , ldc) - 16 ( win32 , dmd 2.051) - 16 ( cygwin32, gdc) - 16 Congrats Ellery: this looks like a stairway to hell. -manfred

Re: Initialising arrays at compile time

2011-01-02 Thread bearophile
Peter Alexander: Ok, someone put me out of my misery, I can't figure out for the life of me how to do this. Basically, I have a vector class and want enums for the zero vectors: struct Vec { this(real x, real y) { e[0] = x; e[1] = y; } real[2] e; enum Vec zero = Vec(0, 0); }

What is an Effect?

2011-01-02 Thread Manfred_Nowak
docs: | Expressions that have no effect, like (x + x), are illegal in | expression statements. But what sorts of effects are meant with this? In phobos the expressionStatement `cmp(foo, bar);' is used in unittest.d. A comment says: | Bring in unit test for module by referencing function in it

Re: What is an Effect?

2011-01-02 Thread Jesse Phillips
Manfred_Nowak Wrote: docs: | Expressions that have no effect, like (x + x), are illegal in | expression statements. But what sorts of effects are meant with this? (x + x) performs a calculation and throws out the result. x = 42; x = 42; This is performing an assignment of the same