Re: writef %d of string

2011-12-04 Thread bearophile
Stewart Gordon: > You mean all programming languages should support CTFE for argument > validation? This is not necessary, and it's not sufficient... > What if the format string isn't even known at compile time in the first place? In this case the format string validation is done at run-time.

Re: writef %d of string

2011-12-04 Thread Stewart Gordon
On 02/12/2011 03:19, bearophile wrote: Stewart Gordon: It's perfectly legal code, If that code is legal, then in my opinion it's the rules of the language that are wrong and in need to be changed :-) You mean all programming languages should support CTFE for argument validation? What if t

Re: Compile time metaprogramming

2011-12-04 Thread Simen Kjærås
On Sat, 03 Dec 2011 10:26:09 +0100, David Nadlinger wrote: On 12/3/11 1:43 AM, simendsjo wrote: On 02.12.2011 23:28, Jonathan M Davis wrote: There's also been at least a couple of cases where people have worked on unit libraries and discussed them in the main newsgroup, but so far, nothing

Re: Why is align() on structures not allowed within unit-test code

2011-12-04 Thread bearophile
Timon Gehr: > The reason is that it is parsed as function-local and that DMD's parser > for some strange reason uses different grammar rules for declarations > when inside a function body. You could maybe file a bug report. http://d.puremagic.com/issues/show_bug.cgi?id=7065 Bye, bearophile

Re: C++ vs D aggregates

2011-12-04 Thread Alex Rønne Petersen
On 03-12-2011 20:14, Dejan Lekic wrote: I recently stumbled on this thread: http://stackoverflow.com/ questions/5666321/what-is-assignment-via-curly-braces-called-and-can-it- be-controlled The important part is this: 8< - begin - The Standard says in section §8.5.1/1,

Re: Why is align() on structures not allowed within unit-test code blocks?

2011-12-04 Thread Timon Gehr
On 12/04/2011 03:01 PM, GrahamC wrote: Is there a good reason why align() applied to structure definitions is not allowed on the struct definition line within unit-test code blocks? E.g.: unittest { align(1) struct Foo { char c; int i; }

Re: C++ vs D aggregates

2011-12-04 Thread Timon Gehr
On 12/04/2011 12:00 PM, Kagamin wrote: Dejan Lekic Wrote: Do D2 aggregates behave the same, or are there notable differences? D restricts usage to static initializers only, C++ doesn't have this limitation. This works: struct S{int x;} void main(){ int a; S x = {a}; } What does n

Why is align() on structures not allowed within unit-test code blocks?

2011-12-04 Thread GrahamC
Is there a good reason why align() applied to structure definitions is not allowed on the struct definition line within unit-test code blocks? E.g.: unittest {      align(1) struct Foo {         charc;         int i;     }      void Bar() {           Foo f;      }

Re: DMD semantic passes overview?

2011-12-04 Thread Jacob Carlborg
On 2011-12-02 19:01, Nick Sabalausky wrote: I don't suppose there's any information out there on how DMD's sematic passes work? (esp, regarding types, forward reference resolution and DSymbol::scope as used by AggregateDeclaration, but I suppose getting that specific might be asking too much). I

Re: C++ vs D aggregates

2011-12-04 Thread Kagamin
Dejan Lekic Wrote: > Do D2 aggregates behave the same, or are there notable differences? D restricts usage to static initializers only, C++ doesn't have this limitation.