foreach

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 16 07:53:49 PDT 2014


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.


T

-- 
Старый друг лучше новых двух.


More information about the Digitalmars-d mailing list