On Thu, Dec 23, 2010 at 5:38 PM, Andrej Mitrovic <[email protected] > wrote:
> On 12/24/10, Caligo <[email protected]> wrote: > > You got me excited, so I decided to give GDC another try. I cloned the > > repo, and using GCC 4.4.5, it compiled without errors. > > I started following the examples in TDPL, but the Stat program on page 22 > > gives the following errors: > > > > t1.d:33: Error: void has no value > > t1.d:33: Error: incompatible types for ((readf(" %s ",& x)) == (1)): > 'void' > > and 'int' > > > > is there a typo in the code, or is this some kind of bug in GDC? > > Use stdin.readf: > > import std.exception, std.stdio; > void main(string[] args) { > for (double x; stdin.readf(" %s ", &x) == 1; ) { > } > } > > The TDPL errata is here btw, that bug is listed: > http://erdani.com/tdpl/errata/index.php?title=Main_Page > great, that fixed the problem. I was actually trying to find the errata too, so thanks for that. The example compiles but it throws an exception: >> echo 3 4 6.6 7.7 33.4 | ./t1 Min Max Average [email protected]@30
