Am 21.06.2011 20:36, schrieb Le_Forgeron:
> I wonder a bit about the construct
>
> while ( !Stream.eof() )
> {
> // get and preprocess line
> std::getline(Stream, line);
> line = pre_process_conf_line(line);
> ++line_number;
>
> // skip empty line
> if(line.length() == 0)
> continue;
>
> If the last line is length 0, would the eof() be evaluated (again) ?
The C/C++ language construct
while ( <CONDITION_1> )
{
<STATEMENTS_A>
if ( <CONDITION_2> ) continue;
<STATEMENTS_B>
}
is fully equivalent to
while ( <CONDITION_1> )
{
<STATEMENTS_A>
if ( ! <CONDITION_2> )
{
<STATEMENTS_B>
}
}
Post a reply to this message
|