|
Boost : |
Subject: Re: [boost] Interest in breakable labeled scope emulation?
From: Vicente J. Botet Escriba (vicente.botet_at_[hidden])
Date: 2013-01-16 12:17:52
Le 16/01/13 13:20, TONGARI a écrit :
> 2013/1/16 Vicente J. Botet Escriba <vicente.botet_at_[hidden]>
>
>> Le 15/01/13 18:44, Jeffrey Lee Hellrung, Jr. a écrit :
>>
>> (b) in those rare situations, explicitly using gotos and labels (with a
>>> descriptive name) is reasonably brief and readable;
>>> so I would be hesitant to adopt this.
>>>
>>>
>> When we use label/goto directly there is a risk that the user goto to the
>> label without constructing all the scoped variables, v in this case.
>>
>> if (cnd3) goto L; // bad as v constructor will not be called.
>> {
>> T v;
>> for(;;)
>> {
>> while (cnd)
>> {
>> if (cnd2) goto L; // go to [1]
>> }
>> }
>> L: // [1]
>> std::cout << v <<std::endl;
>> }
>>
> Actually this won't compile if T is not a POD.
>
>
You are right. Sorry for the noise.
Vicente
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk