Mail Archives: djgpp/1998/06/04/04:44:26
From: "Aleksey Kondratyev" <akondra AT no-spam-mv DOT ru>
Subject: DJGPP 2.8.0 labels as values problem
Date sent: Thu, 4 Jun 1998 11:05:12 +0400
> Hello DJGPP users,
>
> I have a problem using labels as values gcc extension
> in a c++ module. The following sample was compiled
> fine by DJGPP 2.7.2.1but 2.8.0 version complains on
> "Error: sorry, not implemented: initializer contains
> unrecognized tree code".
Looks that it works with 2.7.2.1 but gives message You mentioned above
with 2.8.1. If such code is really needed then perhaps You should
currently use 2.7.2.1. The second thing You should do is to send bug report
about gcc (see info files how to do this)
>
> #include <fstream.h>
> #define ADD 0
> #define SUB 1
> template<class T>
> T do_it(T a,T b,int op) {
> static void *oops[]={&&op_add,&&op_sub};
> goto *oops[(const int)op];
> op_add:
> return a+b;
> op_sub:
> return a-b;
> }
> int main() {
> cout<<do_it(2,2,ADD)<<'\n'<<do_it(2,2,SUB);
> return 0;
> }
>
> It is compiled fine without 'templates' but avoiding
> of a template in my real module is quite difficult.
> Please, suggest something!
> E.g., is it be possible to declare labels in g++
> beforehand?
>
- Raw text -