The Thermopylae excerpt of TDPL available online

Saaa empty at needmail.com
Fri Oct 30 09:55:46 PDT 2009


Andrei Alexandrescu wrote:
> Andrei Alexandrescu wrote:
>> Saaa wrote:
>>> Could anybody clear these up for me?
>>>
>>>> p16. Is there anything other than the random values, unsafe about void 
>>>> assignment?
>>
>> I'd put your feedback on my pile of things to do, but now that you ask, I 
>> made this change to the incriminated paragraph:
>>
>> ===========
>> Such  uninitialized arrays  are particularly  useful for  large arrays
>> that serve  as temporary buffers.   An uninitialized integral  may not
>> cause  too   much  harm,  but  uninitialized  values   of  types  with
>> indirections (such as arrays themselves) are unsafe.
>> ===========
>>
>>>> p18. What is unsafe about implicit conversion of static to dynamic 
>>>> array?
>>>>        Meaning getting a dynamic array pointing to a stack allocated 
>>>> array.
>>>>        Any operation changing its size could copy the array to the 
>>>> heap. What am I missing
>>
>> T[] fun() { T[10] a; return a; }
>> ...
>> auto x = fun(); // gained access to recycled stack memory
>>
>> There's no change in size there.
>>
>>>> p20. 10 int take up 40 words?
>>
>> The example given has a per-row payload of 10 ints, i.e. 40 words.
>
> It's bytes actually. So finally I rewrote those last words as:
>
> "... small  per-row payload of~10  @int at s (40 bytes)."
>
>
> Andrei

Thanks !

Out of interest, do you keep a list of common error or something alike that 
helps you keep errors at a minimum?
Also, do you have automated example checking?
Or, more general, I would be interested in a small article explaining how a 
book like this is written.

Maybe After the book is finished :) 




More information about the Digitalmars-d-announce mailing list