Delphi in a Nutshell coverDelphi in a Nutshell

Errata

January 29, 2003

Deletions are shown with the strike-through style. Insertions are shown in boldface. Thanks to everyone who found errors and reported them:

If you find more errors or problems with Delphi in a Nutshell, please tell me about them. (Send email to nutshell AT tempest-sw.com) Thank you.


p. 9, Note. Sentence 1:

The floating-point hardware usually uses the full precision of the Extended type for its computations, ...


p. 10, Example 1-6, line 5:

  Currency64Scale = 10000;  // 10**DecimalCurrency64Decimals


p. 12, Example 1-7 (2000-Dec-12)

Data[LengthHigh(Data)] := Value;


p. 18, paragraph 2, line 4,

functions, so the function calls are not checked for correctness untilat runtime.


p. 29, Note, line 5

safe, if your function returns a string, interface, dynamic array, or Variant


p. 173, Currency Tips and Tricks (2001-Feb-1)

reducing the Currency type to 5354 or fewer bits.


p. 183, Tips and Tricks (2000-Dec-12)

you can use threadvar variables when attackingattaching the DLL to a new thread

[must be a Freudian slip...]


p. 190, example, line 7

if GetModuleFileName(Instance, FileName, SizeOf(FileName)) > 0 then


p. 210, Example (2000-Dec-12)

TIntArray = array of TntegerInteger;


p. 316, Example (2003-Jan-27)

TSingleVector = class(TVector)


p. 334, SetLength Example, line 6 (2000-Dec-12)

FillChar(Result[1], Length, CharFill);


p. 415, With Keyword
(Items #2 and #3 are in the wrong order. Swap #2 with #3.)

1. Members of records, ...
2. Local variables and subroutine parameters...
3. Members of Self...
4. Global variables in the same unit...
5. Global variables declared in other units...


p. 439, $BoolEval Compiler Directive, Syntax

{$B-}           // default
{$BoolEval Off} // default
{$B+}
{$BoolEval On}
{$B+}           // default
{$BoolEval On} // default
{$B-}
{$BoolEval Off}

p. 439, Note, line 2
disabledenabled. Do not enabledisable this option unless you know the code does

p. 439, Example, line 3

{$BoolEval On}
{$BoolEval Off}

p. 440, Example 1, line 3

{$BoolEval Off}
{$BoolEval On}

p. 477, paragraph 7

Default is -$B+ -$B-


p. 479, -$V, first paragraph,
When disabled, loosens restrictions on var string parameters to allow short string arguments


p. 507, StringReplace function, sentence 1
StringReplace returns a copy of S, where NewOldSubStr is replaced by OldNewSubStr.

p. 514-515, AnsiTrim function, (changes are on lines 5, 6, 26, 36, below) (2000-Dec-12):

// Trim space and control characters.
// Handle multi-byte strings correctly.
function AnsiTrim(const S: string; TrimType: TTrimTypes): string;
var
  Left, Right: 10..MaxInt;
  I: 10..MaxInt;
begin
  Left := 1;
  Right := Length(S);
  if ttLeft in TrimType then
  begin
    I := 1;
    while I <= Length(S) do
    begin
      if S[I] in LeadBytes then
        Inc(I)
      else if Ord(S[I]) > Ord(' ') then
        Break;
      Inc(I);
    end;
    Left := I;
  end;
  if ttRight in TrimType then
  begin
    I := Length(S);
    while I >= Left do
    begin
      if ByteType(S, I) = mbTrailByte then
        Dec(I)
      else if Ord(S[I]) > Ord(' ') then
        Break;
      Dec(I);
    end;
    Right := I;
  end;
  Result := Copy(S, Left, Right-Left+1);
end;


p. 517, first paragraph, penultimate line,

ValueType (that is, ftfvCurrency or ftfvExtended). If the ValueType and the


p. 524, first paragraph, 2nd line,

be ftfvCurrency or ftfvExtended and must match the type of Value. The


p. 540, Example, line 9

if dwWin32MinorVersion = 0 then

p. 540, Example, line 16 (append semicolon):

Win32BuildNumber and $FFFF]);