D - default initialisers
- imr1984 <imr1984_member pathlink.com> Apr 15 2004
- "Phill" <phill pacific.net.au> Apr 16 2004
- "Walter" <walter digitalmars.com> Apr 16 2004
- Manfred Nowak <svv1999 hotmail.com> Apr 19 2004
how good is dmd at optimising away the default initialisers when it is guaranteed that a variable will be initialised later than the variable declaration? I am concerned about this because my program is very time critical. I think it would be cool if there was an attribute for variable declarations not to be initialised by default.
Apr 15 2004
"imr1984" <imr1984_member pathlink.com> wrote in message news:c5mttq$la8$1 digitaldaemon.com...how good is dmd at optimising away the default initialisers when it is guaranteed that a variable will be initialised later than the variable declaration? I am concerned about this because my program is very time
I think it would be cool if there was an attribute for variable
to be initialised by default.
But if they arent given a default value, dont they then just contain garbage anyway? If so, isnt it better to have a default value? Phill. --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.659 / Virus Database: 423 - Release Date: 4/15/2004
Apr 16 2004
"imr1984" <imr1984_member pathlink.com> wrote in message news:c5mttq$la8$1 digitaldaemon.com...how good is dmd at optimising away the default initialisers when it is guaranteed that a variable will be initialised later than the variable declaration? I am concerned about this because my program is very time
I think it would be cool if there was an attribute for variable
to be initialised by default.
The compiler uses 'data flow analysis' to detect and remove dead assignments, and it works reasonably well. Try it and see.
Apr 16 2004
Walter wrote:The compiler uses 'data flow analysis' to detect and remove dead assignments, and it works reasonably well. Try it and see.
WinXP dmd 0.82 <code> import std.c.windows.windows; void main(){ double dtime(){ return (cast(double) GetTickCount) / 1000; } const long size=1_400_000_000; double start= dtime; int[] arr=new int[size/4]; //arr[1]=1; double end= dtime; printf("%20.20f\n", end - start); } </code> Although I commented the access out, the runtime stays by more than 1.5 seconds, whereas the according C program hushes by. So long!
Apr 19 2004









"Phill" <phill pacific.net.au> 