> I think a C++ class (or rather, class template) with inline functions is > the way to go here. gcc's optimiser will give good code, and the C++ > class will let you get nice syntax to hide the messy details. > > There is no good way to do this in C. Named address spaces would be a > possibility, but require quite a bit of effort and change to the > compiler to implement, and they don't give you anything that you would > not get from a C++ class. > > (That's not quite true - named address spaces can, I believe, also > influence the section name used for allocation of data defined in these > spaces, which cannot be done by a C++ class.) >
Does the C++ template class shebang work for storing "short code pointers" for things like compile-time/link-time generated function tables? Haven't tried it myself, but somehow I doubt it. Cheers, Oleg