Re: offsetof + foreach

2012-09-08 Thread Kenji Hara
On Friday, 7 September 2012 at 17:32:43 UTC, Ellery Newcomer wrote: On 09/07/2012 10:31 AM, Ellery Newcomer wrote: I have a struct buffer, and I want to print out its members' offsetof. This: foreach(i,_t; buffer.tupleof) { writefln(%s@: %s, _t.stringof, _t.offsetof); }

string to thread

2012-09-08 Thread monarch_dodra
In C++ (not C), when you wanted to parse a string, you were supposed to put the string inside a stream (std::stringstream), and then parse that new stream stream. As a general rule, stringstream also allowed abstracting a string into a more generic stream. I did not find anything equivalent

Re: string to thread

2012-09-08 Thread Jonathan M Davis
On Saturday, September 08, 2012 11:01:50 monarch_dodra wrote: In C++ (not C), when you wanted to parse a string, you were supposed to put the string inside a stream (std::stringstream), and then parse that new stream stream. As a general rule, stringstream also allowed abstracting a string

Re: bigint - python long

2012-09-08 Thread Russel Winder
On Sat, 2012-09-08 at 00:58 +0200, bearophile wrote: […] If you support NumPy well and efficiently through Pyd, I think some people will start using the D language just for this :-) NumPy is good but it usually forces you to program vectorially, like Matlab. Sometimes this is not nice, so

Re: bigint - python long

2012-09-08 Thread Russel Winder
On Fri, 2012-09-07 at 15:21 -0700, Ellery Newcomer wrote: On 09/06/2012 12:07 AM, Russel Winder wrote: […] just used your scons fork to build the pyd embedded unittests. works pretty nice Splendid :-) If you see any problems or glitches, let me know and/or post a bug report. Although I said

Re: linker @_@

2012-09-08 Thread Johannes Pfau
Am Fri, 07 Sep 2012 16:13:28 -0700 schrieb Ellery Newcomer ellery-newco...@utulsa.edu: playing with some old headers I had lying around, dmd libdw_test.d {{header files}} -L-ldw gives me /usr/bin/ld: /usr/lib64/dmd-2.060/libphobos2.a(memory_4a8_620.o): undefined reference to symbol

Re: int[3][4]*

2012-09-08 Thread Artur Skawina
On 09/08/12 05:27, Timon Gehr wrote: On 09/08/2012 04:19 AM, bearophile wrote: Ellery Newcomer: alright what's the deal? This is one of the clean ways to do it: void main () { static struct Mat { int[3][4] m; alias m this; } Mat* fooz = new Mat;

Re: int[3][4]*

2012-09-08 Thread bearophile
Timon Gehr: This may corrupt your heap. I usually don't put the alis this... I prefer this: void main(){ alias int[3][4] fooz; int[3][4]* i = (new fooz[1]).ptr; } This allocates past the size of the array, the information to append to the array of fooz. It's a very little

Re: int[3][4]*

2012-09-08 Thread Timon Gehr
On 09/08/2012 01:21 PM, bearophile wrote: Timon Gehr: This may corrupt your heap. I usually don't put the alis this... I prefer this: void main(){ alias int[3][4] fooz; int[3][4]* i = (new fooz[1]).ptr; } This allocates past the size of the array, the information to append to

Re: linker @_@

2012-09-08 Thread Ellery Newcomer
On 09/08/2012 03:39 AM, Johannes Pfau wrote: -L-llzmadec Woot! it worked!

since when was this valid syntax?

2012-09-08 Thread Ellery Newcomer
alias enum int e;

Re: bigint - python long

2012-09-08 Thread Ellery Newcomer
On 09/08/2012 03:09 AM, Russel Winder wrote: On Fri, 2012-09-07 at 15:21 -0700, Ellery Newcomer wrote: On 09/06/2012 12:07 AM, Russel Winder wrote: […] just used your scons fork to build the pyd embedded unittests. works pretty nice Splendid :-) Okay, here:

Re: D and SCons [ was Re: bigint - python long ]

2012-09-08 Thread Russel Winder
On Sat, 2012-09-08 at 07:20 -0700, Ellery Newcomer wrote: […] Okay, here: https://bitbucket.org/ariovistus/deimos-elfutils/overview I have some code with a working makefile and a nonworking SConstruct file. I believe the issue is the header files have pragma(lib, X) in them, and a single

Re: since when was this valid syntax?

2012-09-08 Thread Timon Gehr
On 09/08/2012 04:11 PM, Ellery Newcomer wrote: alias enum int e; It is valid according to the grammar and DMD ignores meaningless attributes. scope shared @disable @trusted package final override deprecated extern __gshared synchronized pure nothrow ref static abstract immutable alias auto

Re: since when was this valid syntax?

2012-09-08 Thread bearophile
Timon Gehr: It is valid according to the grammar and DMD ignores meaningless attributes. Do you know why? Is it just a unfinished part of dmd, or Walter believes this is an acceptable design for a compiler? In years I have never heard a comment from him on this bad situation. Bye,

Re: since when was this valid syntax?

2012-09-08 Thread Chris Cain
On Saturday, 8 September 2012 at 16:00:44 UTC, Timon Gehr wrote: scope shared @disable @trusted package final override deprecated extern __gshared synchronized pure nothrow ref static abstract immutable alias auto final override deprecated extern __gshared synchronized enum pure nothrow ref

Re: since when was this valid syntax?

2012-09-08 Thread Timon Gehr
On 09/08/2012 06:44 PM, bearophile wrote: Timon Gehr: It is valid according to the grammar and DMD ignores meaningless attributes. Do you know why? No reason. Is it just a unfinished part of dmd, or Walter believes this is an acceptable design for a compiler? Jonathan would say he has

Re: since when was this valid syntax?

2012-09-08 Thread Maxim Fomin
On Saturday, 8 September 2012 at 16:00:44 UTC, Timon Gehr wrote: On 09/08/2012 04:11 PM, Ellery Newcomer wrote: alias enum int e; It is valid according to the grammar and DMD ignores meaningless attributes. scope shared @disable @trusted package final override deprecated extern __gshared

Re: since when was this valid syntax?

2012-09-08 Thread Timon Gehr
On 09/08/2012 09:25 PM, Maxim Fomin wrote: On Saturday, 8 September 2012 at 16:00:44 UTC, Timon Gehr wrote: On 09/08/2012 04:11 PM, Ellery Newcomer wrote: alias enum int e; It is valid according to the grammar and DMD ignores meaningless attributes. scope shared @disable @trusted package

Re: since when was this valid syntax?

2012-09-08 Thread Jonathan M Davis
On Saturday, September 08, 2012 20:25:38 Timon Gehr wrote: Jonathan would say he has more important things to do. If someone else did it and had good enough arguments why the change should be made, then it might make it in, but on top of Walter's time issues, this strikes me as the sort of

Re: since when was this valid syntax?

2012-09-08 Thread Era Scarecrow
On Saturday, 8 September 2012 at 18:16:33 UTC, Chris Cain wrote: Time to hold an obfuscated D contest! Hmmm... A little more difficult compared to C, since you don't have the pre-processor. I recall TCC (Tiny C Compiler) was originally done in a obfuscation contest where he got the main

Re: since when was this valid syntax?

2012-09-08 Thread Maxim Fomin
2012/9/8 Timon Gehr timon.g...@gmx.ch: On 09/08/2012 09:25 PM, Maxim Fomin wrote: On Saturday, 8 September 2012 at 16:00:44 UTC, Timon Gehr wrote: On 09/08/2012 04:11 PM, Ellery Newcomer wrote: alias enum int e; It is valid according to the grammar and DMD ignores meaningless

const attribute makes whole element const?

2012-09-08 Thread Namespace
Why fail this code? without const on Name it works fine. http://dpaste.dzfl.pl/9fa0986a

Re: const attribute makes whole element const?

2012-09-08 Thread Timon Gehr
On 09/09/2012 01:16 AM, Namespace wrote: Why fail this code? without const on Name it works fine. http://dpaste.dzfl.pl/9fa0986a const fields cannot be written to. This includes the case when the entire struct is written to at once.