Mail Archives: djgpp/2000/08/03/18:01:45
----=---=-=-=--==-==---===-=----=--=---=---==-=-=-
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"; format=flowed
One good reason to keep in mind: you may get into the habit of using it.
And in C, it's a worse habit than BASIC. Let's say that you have an
oft-used loop whose nesting make this one look simple. Let's say you want
to break out of it simply. Lets say that you forgot there's a free() five
levels out after this point. You use goto. See a potential problem?
Wow. I've been reading too many "War On Drugs" propaganda items today,
haven't I? Anyway, I *think* it's somewhat coherent...
--Matt
At 01:36 PM 8/3/00, you wrote:
>djgpp AT delorie DOT com wrote:
> >>Try 'goto'. You'll love it. They never taught you about it in
> >>school.
> >
> >EEK! There are reasons for this! GoTo is "forbidden"! Nicer is to put this
> >into a function
> >that returns TRUE/FALSE. So, as soon as a collition is detected, you jump
> >out of the
> >function with false. This will break the loops. Might be considered cheating
> >but it
> >helps for making the code more usable so there is a good fix to this
> >problem.
> >
>
>Name just one of those reasons agains goto, other then "it looks like
>BASIC and real hardcore C coders don't use that kiddy stuff."!
>
>I didn't yet see one solution in this thread, that was as easy to read
>as a simple little goto. Checking a flag for every for, building the
>whole nest in a function and return? Picture yourself reading that
>code! Goto will also give you the benefit of feeling superior to the
>moron who still uses goto after all this years:-)
>
>Back to the beginning: Name one reason against using goto. At least
>name the law the forbids using goto.
>
>Come on, convince me!
>
>
>--
>
>Manni
>
>Life would be much easier if I had the source code.
----=---=-=-=--==-==---===-=----=--=---=---==-=-=-
Content-Type: application/pgp-signature
-----BEGIN PGP MESSAGE-----
Version: PGPfreeware 6.5.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBOYnqyOoMko8dOmunEQLjtgCfYL9cfMJroMXlStJUDL4/uboySIgAn0AK
3E5OXoPTn2hjHms6Wf1LdfDl
=yvpG
-----END PGP MESSAGE-----
----=---=-=-=--==-==---===-=----=--=---=---==-=-=---
- Raw text -