Thread overview | |||||
---|---|---|---|---|---|
|
April 08, 2005 default initializers | ||||
---|---|---|---|---|
| ||||
can we have a command line option to turn the code that creates the defautl initializing of variables OFF? I personally never rely on it - I always initialize my variables explicitly if I know that they are going to be read from right away; and I worry that this implicit initialization would be inneficient |
April 08, 2005 Re: default initializers | ||||
---|---|---|---|---|
| ||||
Posted in reply to imr1984 | -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 imr1984 schrieb am Fri, 8 Apr 2005 08:45:21 +0000 (UTC): > can we have a command line option to turn the code that creates the defautl initializing of variables OFF? I personally never rely on it - I always initialize my variables explicitly if I know that they are going to be read from right away; and I worry that this implicit initialization would be inneficient Maybe support for "-Wuninitialized" and correct dataflow analysis in the compiler to remove unrequired initialization is better. (1) from: # int i; # i = 2; (1) to: # int i = 2; (2) from: # char[2] arr; # char[0]='a'; # char[1]='b'; (2) to: # int[2] arr = ['a', 'b']; TODO: * can turn out quite compilcated for some flowcharts - e.g. Object initializers * requires additon of _d_new... without the use of memset to the GC Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCVkuu3w+/yD4P9tIRAmVuAJsEPS/sqoTZxv5TYsRLXPfAB1s/xQCeLXwn 4Zxr2YNTzt7IHeugq53oS0I= =mVzl -----END PGP SIGNATURE----- |
April 08, 2005 Re: default initializers | ||||
---|---|---|---|---|
| ||||
Posted in reply to imr1984 | "imr1984" <imr1984_member@pathlink.com> wrote in message news:d35gb1$1uhf$1@digitaldaemon.com... > can we have a command line option to turn the code that creates the defautl > initializing of variables OFF? I personally never rely on it - I always initialize my variables explicitly if I know that they are going to be read from > right away; and I worry that this implicit initialization would be inneficient The optimizer will eliminate most redundant initializations, so there shouldn't be much of any efficiency problem. |
Copyright © 1999-2021 by the D Language Foundation