[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: My First Computer
In article <868ywmhqg7.fsf@raw.grenland.fast.no>,
Raymond Wiker <Raymond.Wiker@fast.no> wrote:
> pausch@saaf.se (Paul Schlyter) writes:
>
>> In article <86el6ggyeo.fsf@raw.grenland.fast.no>,
>> Raymond Wiker <Raymond.Wiker@fast.no> wrote:
>>
>>> Anyway, using while() or for() to implement this is silly: C
>>> *has* goto :-)
>>
>> Apparently you're a supporter of "spaghetti programming"..... :-)
>
> No, I'm not.
Replacing while or for loops with conditional or unconditional
goto's leads you towards spaghetti programming.
> On the other hand, I'm not a supporter of
> mindlessly following other peoples (mis)conceptions about programming.
> In other words, I use goto whenever that makes for simpler code.
>
> That said, I wouldn't use goto for an infinite loop,
OK, so we at least agree on that one....
> even though that is clearer than misusing "while" or "for" :-)
THAT depends on how you've learnt to read....
>> Yes, C has goto, and there are valid uses for goto in C, however
>> replacing a while or for loop is not one of them.
>
> while(1) and for(;;) are the idiomatic forms of an infinite
> loop in C. That is the only reason they may be preferable to using
> goto...
One reason is enough. Likewise an if() is the idiomatic form of
a conditional jump in C..... :-)
--
----------------------------------------------------------------
Paul Schlyter, Swedish Amateur Astronomer's Society (SAAF)
Grev Turegatan 40, S-114 38 Stockholm, SWEDEN
e-mail: pausch at saaf dot se
WWW: http://hem.passagen.se/pausch/index.html
http://home.tiscali.se/~pausch/