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. Ross NextBus 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; }