Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Jun 1998 23:09:27 +0000 (GMT)
From:      Terry Lambert <tlambert@primenet.com>
To:        mike@smith.net.au (Mike Smith)
Cc:        hetzels@westbend.net, mike@smith.net.au, current@FreeBSD.ORG
Subject:   Re: ppp cannot find libalias
Message-ID:  <199806022309.QAA23355@usr01.primenet.com>
In-Reply-To: <199806021711.KAA01018@antipodes.cdrom.com> from "Mike Smith" at Jun 2, 98 10:11:01 am

next in thread | previous in thread | raw e-mail | index | archive | help
> > >Not even the hint cache.  Note that this is the a.out rtld; I don't 
> > >know (yet) where to look for the ELF one.
> >
> > Mike, I cleaned up your code, I HATE goto's.
> 
> Terry likes them.  I find them easier to deal with than insane nesting.

I don't like them or not like them; I think it's silly to use bizarre
constructs to avoid indentation, ie:

	for(;;) {
		if( aaa)
			break;
		if( bbb)
			break;
		if( ccc)
			break;
		if( ddd)
			break;
		if( eee)
			break;
		break;
	}

You might as well use "?:" constructs.  8-|.

What I like is single-entry/single-exit, and if it occasionally
takes a goto to make this work, I prefer a goto (which has a specific,
named target that I can search for) to a break (which may dump me out
after any particular closing brace, and I have to go searching to find
out which one).

People who hate goto's for the sake of hating goto's don't understand
that no matter how hard they try, the compiler is going to generate
branch and jump instructions, and there's nothing they can do about it
in a high level language, except cause the optimizer to invoke loop
register preload and unrolling optimizations erroneously.

A goto is a perfectly valid way to handle an exceptional condition;
if you see you are skipping a lot of code with one, you have probably
failed to correctly perform the necessary functional decomposition on
your code; shame on you.  There are numerous examples of this in the
FreeBSD kernel, unfortunately.  If you see yourself using a lot of
goto's, well, it's either beta code that you've written that way for
program flow readability (don't expect or suggest that it should be
checked in), or you're optimizing for something other than the most
common case and you are probably writing code that's a lot slower than
it ought to be.

For non-beta code, where it's now known to work, converting goto's to
negative logic is a win (it saves branch instructions).

> Are there any disagreements with the basic idea, ie. use rtfindfile() 
> to locate files requested by dlopen() if they do not contain path 
> components?

I think it's fine.  That's why I didn't bitch the first time it went
by... 8-).


					Terry Lambert
					terry@lambert.org
---
Any opinions in this posting are my own and not those of my present
or previous employers.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199806022309.QAA23355>