2 ms·
Optimizing global constant data structures using relative references
- kazinator 9y ago> Unfortunately, C and C++ don't consider expressions involving subtracting global addresses to be constant expressions. It's more like, the standards don't require those to be constant expressions. ISO C allows implementations to consider additional expression types to be constant expressions. Including possibly ones that don't have standard-defined behavior, Like these: subtracting pointers to different objects is not well defined, but that is largely moot on flat memory architectures.