Timeline for c++ const for pointer to pointer
Current License: CC BY-SA 4.0
8 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Jan 3, 2024 at 12:25 | comment | added | KrisW | It’s worth noting that const-correctness isn’t a purely academic question if you write for embedded systems. In embedded applications, the const keyword signals an intention that the item should be stored in the device’s Program ROM rather than copied from that ROM to program RAM on startup. Most embedded systems have more ROM than RAM, so this is an important distinction when you’re close to the system’s memory limits. | |
| Nov 6, 2019 at 22:13 | comment | added | Eljay | The const keyword binds to the thing to its immediate left. (Unless const appears very first, in which case it binds to the thing to its immediate right.) | |
| Nov 6, 2019 at 21:09 | comment | added | matthias_buehlmann | this is more for my understanding of const-correctness than in order to write production code. I did stumble over it when I tried to replace a statically allocated static const char* foo[1000] with a dynamically allocated static char** foo and the compiler didn't allow me to assign string literals to the elements of foo | |
| Nov 6, 2019 at 21:06 | comment | added | Mark Storer | To be fair: "I have never NOTICED code where it mattered", in my 20+ year career as a programmer, most of which has been spent in C++. | |
| Nov 6, 2019 at 21:06 | answer | added | Paul Evans | timeline score: 0 | |
| Nov 6, 2019 at 21:06 | comment | added | Mark Storer | I suggest typedefs. Lots of typedefs. Lots of typedefs that build on one another. Enough typedefs that you hate life to such a degree that you avoid such foolishness in the future. Yes, the distinction could be important. No, I have never seen production code where it mattered. | |
| Nov 6, 2019 at 21:05 | answer | added | jfMR | timeline score: 3 | |
| Nov 6, 2019 at 21:01 | history | asked | matthias_buehlmann | CC BY-SA 4.0 |