D vs C++
Daniel Gibson
metalcaedes at gmail.com
Sat Dec 25 23:40:46 PST 2010
Am 26.12.2010 01:36, schrieb spir:
> On Sat, 25 Dec 2010 14:03:42 -0800
> Walter Bright<newshound2 at digitalmars.com> wrote:
>
>> bearophile wrote:
>>> Structured programming is good because it usually helps code readability. But
>>> it's not Verb, so in some less common cases a goto, break or continue help
>>> improve the code.
>>>
>>> Misra C Rules totally forbid break and continue, but more human coding
>>> guidelines just suggest to avoid them when possible, they are not evil.
>>
>>
>> I thought the idea that break and continue were bad died about 25 years ago.
>> Pascal didn't allow them, and pretty much everyone hated the workaround of
>> having to use flag variables.
>
> Sure, they're both equivalent to a goto.
I don't think so. They're much more clean and readable than goto (they
just restart/jump behind the current loop or, if you use them with
labels, an outer loop - IMHO that's quite different from jumping to
arbitrary labels).
I guess this is the reason why break and continue are supported in Java
but goto isn't.
> But what they mean makes sense, and it's clear. As you say, workarounds have always been ugly. For me, _that_ is important.
I agree.
>
> Denis
Cheers,
- Daniel
More information about the Digitalmars-d
mailing list