Hacker News new | past | comments | ask | show | jobs | submit login
Optimizing global constant data structures using relative references (duriansoftware.com)
47 points by ingve on Feb 18, 2018 | hide | past | favorite | 1 comment



> 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: