Re: [Flightgear-devel] CC compiler problem?
Erik Hofman wrote: I have a propblem with a peace of CC code which is pretty standard for common C. When I define a structure and point an array to a pre-defined array; [...] this works for C but not for CC? Am I doing something wrong here, or doesn't CC allow this type of declaration (and if not, is there an alternative)? This is perfectly legal C++; I tried it with gcc (full program attached) and it works fine. What errors are you seeing? Andy -- Andrew J. RossNextBus Information Systems Senior Software Engineer Emeryville, CA [EMAIL PROTECTED] http://www.nextbus.com Men go crazy in conflagrations. They only get better one by one. - Sting (misquoted) #include string #include iostream double _fg_lin(double arg) { return 0; } double _fg_log10(double arg) { return 1; } struct { string name; double (*fn)(double); } __fg_snd_[] = { {lin, _fg_lin}, {log, _fg_log10}, {, NULL} }; int main() { cout (*__fg_snd_[0].fn)(1) endl; }
Re: [Flightgear-devel] CC compiler problem?
Andy Ross wrote: Erik Hofman wrote: I have a propblem with a peace of CC code which is pretty standard for common C. When I define a structure and point an array to a pre-defined array; [...] this works for C but not for CC? Am I doing something wrong here, or doesn't CC allow this type of declaration (and if not, is there an alternative)? This is perfectly legal C++; I tried it with gcc (full program attached) and it works fine. What errors are you seeing? the C++ code gives the warning message: fn = NULL while the C code calls log10() twice. Erik ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel
Re: [Flightgear-devel] CC compiler problem?
Andy Ross wrote: Erik Hofman wrote: I have a propblem with a peace of CC code which is pretty standard for common C. When I define a structure and point an array to a pre-defined array; [...] this works for C but not for CC? Am I doing something wrong here, or doesn't CC allow this type of declaration (and if not, is there an alternative)? This is perfectly legal C++; I tried it with gcc (full program attached) and it works fine. What errors are you seeing? This program gives me a core dump, because __fg_snd_[0].fn == NULL. Erik ___ Flightgear-devel mailing list [EMAIL PROTECTED] http://mail.flightgear.org/mailman/listinfo/flightgear-devel