Boost logo

Boost :

From: Daniel Frey (daniel.frey_at_[hidden])
Date: 2003-05-08 11:16:43


Gennaro Prota wrote:
> On Thu, 8 May 2003 15:06:02 +0300, "John Torjo" <john_at_[hidden]>
> wrote:
>
>>Unfortunately, we can't use the do-while(0) idiom, since we don't know when
>>while(0) will be ;-)
>>
>
> Oops, no. That's not the problem. The problem is that I read Daniel's
> reply out of context and too absent-mindedly :-) I thought it was
> something like
>
> if (false) ; else
>
> whereas he is really testing for a condition
>
> if(expr)...
>
> However, if you are going to abort at the end (or throw, but I don't
> want to enter in this matter) you can simply replace 'if' with
> 'while':

But that does not give you any benefit at all, does it? The
do-while-idiom is very different from the while-version you suggest.
It's IMHO the only idiom that forces the user to add a semicolon, but we
actually don't want to do that here. The user should be allowed to add
(i) or other stuff. I think that the 'if' (or 'while', but that's not a
difference) is the best we can do here.

Regards, Daniel

-- 
Daniel Frey
aixigo AG - financial training, research and technology
Schloß-Rahe-Straße 15, 52072 Aachen, Germany
fon: +49 (0)241 936737-42, fax: +49 (0)241 936737-99
eMail: daniel.frey_at_[hidden], web: http://www.aixigo.de

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk