From owner-freebsd-chat Wed Jun 3 02:06:41 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id CAA03840 for freebsd-chat-outgoing; Wed, 3 Jun 1998 02:06:41 -0700 (PDT) (envelope-from owner-freebsd-chat@FreeBSD.ORG) Received: from ns1.yes.no (ns1.yes.no [195.119.24.10]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id CAA03798 for ; Wed, 3 Jun 1998 02:06:26 -0700 (PDT) (envelope-from eivind@bitbox.follo.net) Received: from bitbox.follo.net (bitbox.follo.net [195.204.143.218]) by ns1.yes.no (8.8.7/8.8.7) with ESMTP id JAA21974; Wed, 3 Jun 1998 09:06:24 GMT Received: (from eivind@localhost) by bitbox.follo.net (8.8.8/8.8.6) id LAA29492; Wed, 3 Jun 1998 11:05:59 +0200 (MET DST) Message-ID: <19980603110558.57456@follo.net> Date: Wed, 3 Jun 1998 11:05:58 +0200 From: Eivind Eklund To: Terry Lambert Cc: chat@FreeBSD.ORG Subject: Use of gotos (was Re: ppp cannot find libalias) References: <199806021711.KAA01018@antipodes.cdrom.com> <199806022309.QAA23355@usr01.primenet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.89.1i In-Reply-To: <199806022309.QAA23355@usr01.primenet.com>; from Terry Lambert on Tue, Jun 02, 1998 at 11:09:27PM +0000 Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org [moved to -chat] On Tue, Jun 02, 1998 at 11:09:27PM +0000, Terry Lambert wrote: > 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. If they can that, then they're not working in a high level language, and they're working with a buggy compiler to boot ;-) > [...] 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) Why not? The only reason I can see not to check in something that is written using gotos _for readability_ is the amount of hysteria it could cause. The (original) argument against gotos is that it obscures readability (that was before it become a religious argument due to too many people parroting what they learnt at college :-) I prefer state machines written using goto's - then I get one state variable to relate to (the position in the program) instead of two. > For non-beta code, where it's now known to work, converting goto's to > negative logic is a win (it saves branch instructions). I'm not certain what you're trying to say here. I can't parse this in any way that makes sense WRT optimizing compilers. (Explaining background, in case I'm missing something) I know of no intermediate code that use _both_ gotos and structured programs. In traditional intermediate codes, the representation use an if/goto-network, and starting in this form have no negative impact - it's what it is made for optimizing :-) This is, IIRC, the representation gcc use. In modern (1990s) compilers, everything is represented as a structured program. This is (again IIRC) to make it easier to move expressions around, and doing many of the advanced optimizations. These are supposed to be able to slide code every which way, to exploit common features. I can't see these being hurt by a goto-based implementation, either. So - what am I missing? Eivind. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message