www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: The Thermopylae excerpt of TDPL available online

reply duser4ever <no spam.com> writes:
Andrei Alexandrescu Wrote:

 It's a rough rough draft, but one for the full chapter on arrays, 
 associative arrays, and strings.
 
 http://erdani.com/d/thermopylae.pdf
 
 Any feedback is welcome. Thanks!
 
 
 Andrei

Sure I haven't come across anything that someone else hasn't already pointed out, but here it is any: P133 "Table 9.1 on page 301 summarizes dynamic array operations" should read "Table 3.4 on page 134 summarizes dynamic array operations" P118 something sounds wrong here also: "However, if a function returns T[n], that not automatically converted to T[]--it must be T[n]." maybe "it is not automatically" vice "that not automatically"? P117 this sentence does not sound natural to me; "This means that copying arrays, passing arrays into functions, and returning arrays from functions -- these all copy entire arrays." P111 change "in it" on line 8 to read "into it" P111 change "bailout" on line 21 to read "bail out" P110 change "responsible in making" to "responsible for making" Not clear what you are saying here: "The compiler is free to assume that when optimizing the operations into primitive vector operations offered by the host processor." What is it assuming? That I'm responsible? That the arrays do not overlap? P109 auto a = [1.0, 2.5, 3.6]; auto b = [4.5, 5.5, 1.4]; auto c = new double[3]; // changing to "auto c = (new double[3])[] = 0.0;" or adding the line "c[] = 0.0;" should do the trick c[] += 4 * a[] + b[]; will not work. Since c is of type double[3] it's initial value is set to [nan, nan, nan]; As a result any transaction performed on this array will result in the same if it is not first initialized. P102 eenlists should read enlists P101 change "comes just handy" to "comes in handy"
Oct 31 2009
parent Andrei Alexandrescu <SeeWebsiteForEmail erdani.org> writes:
duser4ever wrote:
 Andrei Alexandrescu Wrote:
 
 It's a rough rough draft, but one for the full chapter on arrays, 
 associative arrays, and strings.

 http://erdani.com/d/thermopylae.pdf

 Any feedback is welcome. Thanks!


 Andrei

Sure I haven't come across anything that someone else hasn't already pointed out, but here it is any: P133 "Table 9.1 on page 301 summarizes dynamic array operations" should read "Table 3.4 on page 134 summarizes dynamic array operations"

Thanks, I'd forgotten to clean the intermediate files before building the entire book.
 P118 something sounds wrong here also:
      "However, if a function returns T[n], that not automatically
      converted to T[]--it must be T[n]."
      
      maybe "it is not automatically" vice "that not automatically"?
 
 P117 this sentence does not sound natural to me;
      "This means that copying arrays, passing arrays into functions, 
      and returning arrays from functions -- these all
      copy entire arrays."
 	
 P111 change "in it" on line 8 to read "into it" 
 
 P111 change "bailout" on line 21 to read "bail out" 
 
 P110 change "responsible in making" to "responsible for making"
 
      Not clear what you are saying here:
 	
      "The compiler is free to assume that when optimizing the operations into
primitive vector operations offered by the host processor."
 	
      What is it assuming? That I'm responsible? That the arrays do not overlap?
 
 P109
      auto a = [1.0, 2.5, 3.6];
      auto b = [4.5, 5.5, 1.4];
      auto c = new double[3]; // changing to "auto c = (new double[3])[] =
0.0;" or adding the line "c[] = 0.0;" should do the trick
      c[] += 4 * a[] + b[];
 	
      will not work. Since c is of type double[3] it's initial value is set to
[nan, nan, nan];
      As a result any transaction performed on this array will result in the
same if it is not first initialized.
 	
 P102 eenlists should read enlists
 
 P101 change "comes just handy" to "comes in handy"

Thanks! Quite a few of these are new. I've added this to my worklist, and as I see you give no email and no name, please email me privately your name so I can add it to acknowledgments. (I'll do so for everyone who sent me feedback.) Andrei
Oct 31 2009