Timeline for Why use const variables instead of preprocessor directives when programming embedded with C++
Current License: CC BY-SA 4.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Jan 3, 2021 at 1:56 | comment | added | ThreePhaseEel | @Dyskord -- POD = Plain Old Data, or standard layout in C++11 and newer -- some aggregate which is guaranteed to be laid out in a C-compatible fashion, basically | |
Jan 2, 2021 at 23:26 | comment | added | Dyskord | Thank you! What does POD stand for? | |
Jan 2, 2021 at 16:46 | comment | added | Pete W | +1 , because in my opinion the namespace issue is the biggest unavoidable drawback to #define . There are some unexpected-effect issues with #define, to be sure, but standard C/C++ programming idioms can prevent those. Polluting the namespace, you can't fix. That said I still use #define's liberally :-/ | |
Jan 2, 2021 at 15:56 | comment | added | the busybee |
No, a #define d value is not unconditionally instantiated when used. Its name is just replaced with its value in the source code, before the compiler decides what to do with it.
|
|
Jan 2, 2021 at 13:58 | history | answered | CSM | CC BY-SA 4.0 |