About 147,000 results
Open links in new tab
  1. When and for what purposes should the const keyword be used in C …

    It has been pointed that this question may be too broad due to all these questions in the detail of my question. I just wanted to clarify that these questions are just to clarify the confusion regarding the …

  2. coding style - In C/C++, should I use 'const' in parameters and local ...

    Oct 5, 2016 · In C/C++, should I use const whenever possible? I know there is already a related question about using const in parameters. Unfortunately that question and it's answers don't fully …

  3. Is it a good idea to const-qualify the fields of structure in C?

    10 C 2011 draft 6.7.3 Type qualifiers ... 6 If an attempt is made to modify an object defined with a const-qualified type through use of an lvalue with non-const-qualified type, the behavior is …

  4. Is there any benefit to to define constant local variables as static ...

    Jun 9, 2017 · A static const local variable is a variable that does not change and is initialized or constructed only once; the first time the function is called. Local static const variables are not stored …

  5. terminology - Difference between immutable and const - Software ...

    In C, C++ and related languages, there is also a difference between an object being const and your reference or pointer to the object being a constant reference.

  6. Benefits or otherwise of using const during variable assignment

    Aug 29, 2017 · The clean const approach: Of course const_cast is something risky, and should be avoided if possible. And that's where the second level benefit of using const appears: you become …

  7. programming practices - Should I be using const more in C

    Nov 2, 2016 · If your code isn't const correct, you're making it much harder for the code that's using your code to be const correct. So if you don't write const correct public interfaces, you force people to …

  8. design - C Const Safety with Struct Data Pointers - Software ...

    Apr 23, 2021 · Would const int32_t * const restrict pData work? I think that says that pData is a const pointer to a const int, but it's been a while since I used C much and I made minimal use of const at …

  9. c - What is the history for naming constants in all uppercase ...

    May 28, 2016 · 27 What is the history behind the convention of naming constants in all uppercase? My intuition is that it started with the C preprocessor, where people developed a practice to name …

  10. Why use `const foo = () => {}` instead of `function foo() {}`

    Jan 17, 2018 · This shows that, because of block-scoping, const function references must be invoked in-order or else things will fail silently.