digitalmars.D - non-initialized variables
- Carlos Santander B. (6/6) Apr 09 2005 Correct me if I'm wrong: wasn't there a syntax for stating that a
- J C Calvarese (6/9) Apr 09 2005 Many posters have proposed a syntax when requesting such a feature be
- Manfred Nowak (5/6) Apr 09 2005 You forget
- J C Calvarese (9/22) Apr 09 2005 You're absolutely correct. I did forget about that. I don't think he's
- =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= (11/21) Apr 10 2005 While we're speaking of improving the values of initialized variables,
- Manfred Nowak (13/17) Apr 11 2005 I think, that the idea to have a mechanism for preventing non
- Carlos Santander B. (5/18) Apr 10 2005 That's what I had in mind. I thought it had been implemented.
- J C Calvarese (9/29) Apr 10 2005 "I've been considering implementing it" is a bit different than "I like
- Georg Wrede (13/44) Apr 11 2005 I fail to see the utility of this.
- Manfred Nowak (15/21) Apr 11 2005 Memory currently widely used is PC3200 which means that 3.2GB/s
- Walter (3/7) Apr 15 2005 No, not yet.
- Kris (11/17) Apr 09 2005 There's an arcane syntax for avoiding explicit initialization of stack-b...
Correct me if I'm wrong: wasn't there a syntax for stating that a variable shouldn't be automatically initialized? I can't remember how it was, and reviewing the docs I couldn't find anything. -- Carlos Santander Bernal JP2, you'll always live in our minds
Apr 09 2005
Carlos Santander B. wrote:Correct me if I'm wrong: wasn't there a syntax for stating that a variable shouldn't be automatically initialized? I can't remember how it was, and reviewing the docs I couldn't find anything.Many posters have proposed a syntax when requesting such a feature be added to D, but Walter hasn't accepted any of the proposals. -- jcc7 http://jcc_7.tripod.com/d/
Apr 09 2005
J C Calvarese <jcc7 cox.net> wrote:but Walter hasn't accepted any of the proposals.You forget http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/15598 Walter seems convinced from the "= void" syntax. -manfred
Apr 09 2005
Manfred Nowak wrote:J C Calvarese <jcc7 cox.net> wrote:You're absolutely correct. I did forget about that. I don't think he's implemented it yet, but maybe it will happen sometime sooner rather than later. Maybe someone should remind Walter. ;) (I don't know that I'd ever use such a feature, but it seems like a reasonable request to make it easy for programmers who desire that power.) -- jcc7 http://jcc_7.tripod.com/d/but Walter hasn't accepted any of the proposals.You forget http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/15598 Walter seems convinced from the "= void" syntax. -manfred
Apr 09 2005
J C Calvarese wrote:While we're speaking of improving the values of initialized variables, even better would be to switch characters and floating points from the current "as-awkward-default-value-as-possible" .init, and have them also start using zeroes like everything else... That would (by accident) also fix the broken starting values of arrays and automagic hash values, too. (that are supposed to have .init values, but just have zeroes right now) But "= void" sounds like a resonable syntax for "make mine C, please". (or "I prefer my variables having random values, thank you very much") Would come in handy in some specialized optimization cases, I guess... --andershttp://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/15598 Walter seems convinced from the "= void" syntax.You're absolutely correct. I did forget about that. I don't think he's implemented it yet, but maybe it will happen sometime sooner rather than later. Maybe someone should remind Walter. ;) (I don't know that I'd ever use such a feature, but it seems like a reasonable request to make it easy for programmers who desire that power.)
Apr 10 2005
Anders F Björklund <afb algonet.se> wrote:even better would be to switch characters and floating points from the current "as-awkward-default-value-as-possible" .init, and have them also start using zeroes like everything else...I think, that the idea to have a mechanism for preventing non deterministic behaviour is a good one. But the implementation of such a mechanism by preinitializing the space used by the variables to some pattern is too unclean as the on and on going remarks on this topic show. There is a solution in additional linear time and space which I have outlined in http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/19936 This seems acceptable for at least debug builds, because before reaching the release stage time and space considerations should be less important. -manfred
Apr 11 2005
Manfred Nowak wrote:J C Calvarese <jcc7 cox.net> wrote:That's what I had in mind. I thought it had been implemented. -- Carlos Santander Bernal JP2, you'll always live in our mindsbut Walter hasn't accepted any of the proposals.You forget http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/15598 Walter seems convinced from the "= void" syntax. -manfred
Apr 10 2005
Carlos Santander B. wrote:Manfred Nowak wrote:"I've been considering implementing it" is a bit different than "I like it and it's now part of D". I just searched through the changelog and I couldn't find any indication that it had been added. If I weren't so lazy, I'd type up a short "= void" example and see if it compiles. ;) -- jcc7 http://jcc_7.tripod.com/d/J C Calvarese <jcc7 cox.net> wrote:That's what I had in mind. I thought it had been implemented.but Walter hasn't accepted any of the proposals.You forget http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/15598 Walter seems convinced from the "= void" syntax. -manfred
Apr 10 2005
J C Calvarese wrote:Carlos Santander B. wrote:I fail to see the utility of this. Consider this: if someone is making code that has to be optimized to such an extent that the time to zero out a variable (which really does not take very much time), becomes significant, then one probably would resort to reusing variables anyhow. Right? Especially so, with a GC language. Also, the D optimizer skips the zeroing anyhow when it sees that the variable is assigned to before use. So the only reason left for not initialising is to spy on memory. And that can already be done in D. Except that Real Operating systems prevent you from acquiring virgin memory without it getting zeroed out, so you still can't spy on others.Manfred Nowak wrote:"I've been considering implementing it" is a bit different than "I like it and it's now part of D". I just searched through the changelog and I couldn't find any indication that it had been added. If I weren't so lazy, I'd type up a short "= void" example and see if it compiles. ;)J C Calvarese <jcc7 cox.net> wrote:That's what I had in mind. I thought it had been implemented.but Walter hasn't accepted any of the proposals.You forget http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/15598 Walter seems convinced from the "= void" syntax. -manfred
Apr 11 2005
Georg Wrede <georg.wrede nospam.org> wrote: [...]time to zero out a variable (which really does not take very much time)Memory currently widely used is PC3200 which means that 3.2GB/s can be _read_. The write performance is at about 1.1GB/s according to aida32. This means that timeslicing at 200Hz and above limits the size of memory chunks that can be written to within one timeslice to 5.5MB or less. So that is the space bound to variables we are talking of.Also, the D optimizer skips the zeroing anyhow when it sees that the variable is assigned to before use.Better use "if" instead of "when", because in general the compiler cannot see whether a variable is assigned to before use.So the only reason left for not initialising is to spy on memory.[...] As pointed out above at least arrays occupying more than 5MB are of interest. -manfred
Apr 11 2005
"Carlos Santander B." <csantander619 gmail.com> wrote in message news:d3bc8f$2cjb$3 digitaldaemon.com...Manfred Nowak wrote:No, not yet.http://www.digitalmars.com/drn-bin/wwwnews?digitalmars.D/15598 Walter seems convinced from the "= void" syntax.That's what I had in mind. I thought it had been implemented.
Apr 15 2005
There's an arcane syntax for avoiding explicit initialization of stack-based arrays. As follows: It avoids initialization only when one uses a constant for the size. Perhaps that could use some syntactic sugar? - Kris "Carlos Santander B." <csantander619 gmail.com> wrote in message news:d39ojr$2ts8$1 digitaldaemon.com...Correct me if I'm wrong: wasn't there a syntax for stating that a variable shouldn't be automatically initialized? I can't remember how it was, and reviewing the docs I couldn't find anything. -- Carlos Santander Bernal JP2, you'll always live in our minds
Apr 09 2005