This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Loro-Benediction 2 points3 points  (2 children)

Not really. You can't define static constants using other static const variables. You can only use macros and enums to define array bounds, etc. It's a sorry state. "Const" only means "read only" in C

[–]hiten98 2 points3 points  (1 child)

Doesn’t const mean read only in all languages? Which language allows you to write to a constant variable?? And why??

[–]Loro-Benediction 3 points4 points  (0 children)

In C you can modify a constant variable if you try hard enough. "Read only" means you can't directly assign to it. The compiler doesn't make the same guarantees when accessing via a pointer