Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!MCC.COM!rfg From: rfg@MCC.COM (Ron Guilmette) Newsgroups: gnu.gcc Subject: address of labels Message-ID: <8904282319.AA08492@riunite.aca.mcc.com> Date: 28 Apr 89 23:19:19 GMT Sender: daemon@tut.cis.ohio-state.edu Distribution: gnu Organization: GNUs Not Usenet Lines: 52 It is apparent that C is being used more and more as a kind of high-level assembly language. GCC supports this kind of usage quite well in general. The embedded assembly language features of GCC are especially helpful in such applications. Of course it is the C language itself, and specifically its closeness to typical hardware that is the real important thing in such situations. I find that I can typically do better that 95% of even very low level coding (e.g. diagnostics and boot code) in C. One blatantly obvious feature seems to be missing however; i.e. the ability to take the address of a label. Is there some way of doing this in GCC that I don't know about? I'd like to be able to construct things like jump tables mostly in C, but I can't for the life of me see how to do it without being able to say something like: int my_func () { static void* jump_table[] = { &label0, &label1, &label2 }; label0: ... label1: ... label2: ... } Now I know that somebody will say that this is just a switch statement and that I should use that, but I have other uses of label addresses in mind also. For instance, I'd like to be able to have a mechanism for expressing things like Ada-style exception handling, e.g.: void my_function () { declare_handler (&exception_handler); ... deactivate_handler (); return; exception_handler: deactivate_handler (); ... return; }