TDPL Errata site is down
Andrej Mitrovic
andrej.mitrovich at gmail.com
Mon Jul 26 09:05:55 PDT 2010
Another one:
Page 76:
The second foreach example with the ref symbol which has the wrong type compiles without an error (it should not).
What is also weird is that the values are left unchanged:
float[] arr = [1.0, 2.5, 4.0];
foreach (ref double elem; arr) {
elem /= 2;
writeln(elem);
}
writeln(arr);
Prints out:
0.5
1.25
2
1 2.5 4
I think this should go into the bug tracker for DMD?
Andrej Mitrovic Wrote:
> Here's some more for the Errata (I've checked against the cached one):
>
> Page 26: "In D, slicing could never occur."
> This should probably be "In D slicing, this could never occur."
>
>
> Page 50: "If the indexing expression is on the left-hand side of an assignment operation (e.g., arr[i] = e) and a is an associative array.."
> 'arr' is an associative array, not 'a'
>
>
> Page 57: "a is c || writefln("Indeed... not the same");"
> Replace writefln with writeln
>
>
> Page 59: "line.length > 0 || line = "\n";
> Compiler error:
> cannot implicitly convert expression ("\x0a") of type string to bool
>
> Andrej Mitrovic Wrote:
>
> > I can't compile the stats example, it uses readf() (on page 22), but the compiler complains that it's undefined. I found readf() in the library under std.stream, but importing that won't work. I'm using DMD 2.047.
> >
> > Andrei Alexandrescu Wrote:
> >
> > > Andrej Mitrovic wrote:
> > > > Or, it has some database problems.
> > > >
> > > > http://erdani.com/tdpl/errata/index.php?title=Errata_for_%22The_D_Programming_Language%22_book
> > > >
> > > > Luckily the cached version works fine:
> > > > http://webcache.googleusercontent.com/search?q=cache:nIyQeOaM1hAJ:erdani.com/tdpl/errata/index.php%3Ftitle%3DErrata_for_%2522The_D_Programming_Language%2522_book+the+d+programming+language+errata&cd=3&hl=en&ct=clnk
> > >
> > > Yes, I noticed only this morning. Thanks! The database is gone, but I
> > > saved the google cache of the errata and will reenter the data tonite.
> > >
> > > Thanks again,
> > >
> > > Andrei
> >
>
More information about the Digitalmars-d
mailing list