🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #53250

Re: Does gcc 2.0 support computed gotos?

#53250
From: Mat Hostetter
Date: Fri, 21 Feb 1992 03:33
27 lines
1987 bytes
In article <1992Feb21.023817.17703@athena.mit.edu> mjhostet@slayer.mit.edu (Mat  
Hostetter) writes:
> I saw in the GNU status report that "C has been extended to support
> nested functions, nonlocal gotos, and taking the address of a label."
> 
> Will there be any way to have an array of label-pointers and dispatch to the  
> one I want?  (eg, "goto label_array[x]".)  (I basically need a switch that  
does  
> no bounds checking, for a really speed-intensive loop.)
> 
> -Mat

Judging from the email I've gotten, apparently I was too concise.  I *KNOW* gcc  
(sometimes) makes a dispatch table internally.  However, it makes sure that the  
index into that table (based on the switch #) references something in that  
table.  This is how it skips case's not explicitly handled by the switch and  
higher than the highest case number.  This is perfectly reasonable behavior.

However, in my situation can guarantee that the X in the switch (X) will always  
be handled by some case statement, so I don't want the internal bounds check.   
Unfortunately, I've been unable to coerce gcc into avoiding the check.  Even  
when it switches on a 3 bit bitfield for case 0: case 1: ... case 7:  it  
generates code to check to see if that number is > 7.

Yes, the cycles are really that important...

-Mat
Technical Details
Message-ID: <1992Feb21.033356.18370@athena.mit.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!mintaka.lcs.mit.edu!bloom-picayune.mit.edu!news
References: <1992Feb21.023817.17703@athena.mit.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 11318c,5fb12b206120b8ea
X-Google-Attributes: gid11318c,public
X-Google-ArrivalTime: 1992-02-20 20:01:35 PST
Newsgroups: gnu.gcc.help
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!mintaka.lcs.mit.edu!bloom-picayune.mit.edu!news
From: mjhostet@slayer.mit.edu (Mat Hostetter)
Subject: Re: Does gcc 2.0 support computed gotos?
Message-ID: <1992Feb21.033356.18370@athena.mit.edu>
Sender: news@athena.mit.edu (News system)
Nntp-Posting-Host: slayer.mit.edu
Organization: Massachvsetts Institvte of Technology
References: <1992Feb21.023817.17703@athena.mit.edu>
Date: Fri, 21 Feb 1992 03:33:56 GMT
Lines: 27