long compile time question
Jonathan M Davis
jmdavisProg at gmx.com
Wed Oct 24 14:58:00 PDT 2012
On Wednesday, October 24, 2012 21:35:22 Manfred Nowak wrote:
> Dan wrote:
> > The following takes nearly three minutes to compile.
>
> ... and this returns immediately:
>
> --------------------------------
> struct B {
> const size_t SIZE = 1024*64;
> int[SIZE] x= void; // !!!
> }
>
> void main() {
> B[] barr;
> barr ~= B();
> }
> -------------------------------
> - manfred
That's incredibly dangerous though, because than B.init has garbage in it.
Still, it's interesting that it would affect the speed. Maybe the compiler
recognizes that it's garbage and so doesn't bother copying it (meaning that
you'll get different garbage for every use of B.init).
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list