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