foreach

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 16 08:09:02 PDT 2014


On Mon, 16 Jun 2014 10:53:49 -0400, H. S. Teoh via Digitalmars-d  
<digitalmars-d at puremagic.com> wrote:

> On Mon, Jun 16, 2014 at 09:24:56AM -0400, Steven Schveighoffer via  
> Digitalmars-d wrote:
>> On Sun, 15 Jun 2014 20:38:53 -0400, H. S. Teoh via Digitalmars-d
>> <digitalmars-d at puremagic.com> wrote:
>>
>> >On Sun, Jun 15, 2014 at 03:05:37AM -0400, Nick Sabalausky via
>> >Digitalmars-d wrote:
>> >[...]
>> >>True story: I once had to put up with a production codebase (the
>> >>company's *flagship* product) that wasn't asm (it was VB6) and yet was
>> >>filled with garbage like this:
>> >>
>> >>if ...cond... then
>> >>   ...statements...
>> >>   goto somelabel
>> >>end
>> >>...statements...
>> >>somelabel:
>> >>
>> >>Got posted on thedailywtf for that one.
>> >
>> >I see code like that *all the time*. It's about the only sane way you
>> >can write error-handling code in C:
>>
>> No, you are missing something. Something *else*, that goes along with  
>> if.
>>
>> ;)
> [...]
>
> Unfortunately, in C, that means a function with n statements will
> require n levels of if-else nesting. That may be more textbook-correct,
> but it would be far less readable than the already ugly if-error-goto
> construct above.

The code above is not what you are talking about. It's straightforward  
if-else.

-Steve


More information about the Digitalmars-d mailing list