I believe this usage is correct. iostream sets eof() after an operation fails due to end of file. It is not set when the get pointer is at the end of file.
However, I am surprised that it's stack-allocating three 500 kb char arrays then using a custom getline wrapper that checks lengths instead of using std::string for this purpose. Using 1.5 MB of stack works with linux defaults (8 MB) but probably isn't portable. Kenneth On 12/15/11 07:55, Hieu Hoang wrote: > hi xianhua > > you're probably right, if you manage to change it, please commit it back > to the repository > > Also, this comment is related > http://article.gmane.org/gmane.comp.nlp.moses.user/5715 > > On 15/12/2011 13:48, lixianhua wrote: >> >> >> >> Hi all, >> >> >> >> I am looking into rule extraction in Moses, and I found in >> the main function of “extract-rules.cpp” this line: >> >> if(tFileP->eof()) break; >> >> after getting a line from target file. >> >> this is a way to stop the extraction, but won’t it fail the last line? >> >> Why not put it at the end of the while loop? >> >> >> >> >> >> ---------------------------------------------------- >> >> Best wishes! >> >> Xianhua Li >> >> >> >> >> >> _______________________________________________ >> Moses-support mailing list >> [email protected] >> http://mailman.mit.edu/mailman/listinfo/moses-support > > > _______________________________________________ > Moses-support mailing list > [email protected] > http://mailman.mit.edu/mailman/listinfo/moses-support _______________________________________________ Moses-support mailing list [email protected] http://mailman.mit.edu/mailman/listinfo/moses-support
