🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.help
Article #53275

Re: Does gcc 2.0 support computed gotos?

#53275
From: Mat Hostetter
Date: Tue, 25 Feb 1992 01:34
39 lines
1842 bytes
In article <30150@well.sf.ca.us> tm@well.sf.ca.us (Toshi Morita) writes:
> 
> 
> 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.)
> 
> Maybe I'm missing something, but doesn't stock C handle this?
> 
> Something like this:
> 
> void (*func[32])(void);
> 
> func[0] = func0;
> func[1] = func1;
> func[2] = func2;
> 
> ....
> 
> (*func[x])();

No, this is an array of function pointers.  I was asking about an array of  
labels.  goto *label_array[x] will be loads faster than (*func[x]().  Anyway,  
for those of you who haven't read the new GCC docs, GCC 2 does indeed support  
goto dispatch tables, and in fact appears to do a remarkable job of tracing  
possible control flow even through the dispatch table (to identify dead  
variables, etc.)

> Toshi Morita
> tm@well.sf.ca.us

-Mat
Technical Details
Message-ID: <1992Feb25.013444.3431@athena.mit.edu>
Path: arc1-ca.pugleaf.net!sparky!uunet!think.com!mintaka.lcs.mit.edu!bloom-picayune.mit.edu!news
References: <30150@well.sf.ca.us>

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-24 17:53:16 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: <1992Feb25.013444.3431@athena.mit.edu>
Sender: news@athena.mit.edu (News system)
Nntp-Posting-Host: slayer.mit.edu
Organization: Massachvsetts Institvte of Technology
References: <30150@well.sf.ca.us>
Date: Tue, 25 Feb 1992 01:34:44 GMT
Lines: 39