About 50 results
Open links in new tab
  1. c++ - Why use #define instead of a variable - Stack Overflow

    May 14, 2011 · What is the point of #define in C++? I've only seen examples where it's used in place of a "magic number" but I don't see the point in just giving that value to a variable instead.

  2. How can I use #if inside #define in the C preprocessor?

    How can I use #if inside #define in the C preprocessor? Asked 15 years, 8 months ago Modified 10 months ago Viewed 52k times

  3. How do I define a function with optional arguments?

    How do I define a function with optional arguments? Asked 13 years, 11 months ago Modified 1 year, 7 months ago Viewed 1.2m times

  4. Why do most C developers use define instead of const?

    Mar 4, 2017 · #define simply substitutes a name with its value. Furthermore, a #define 'd constant may be used in the preprocessor: you can use it with #ifdef to do conditional compilation based on its …

  5. c++ - 'static const' vs. '#define' - Stack Overflow

    Oct 28, 2009 · Is it better to use static const variables than #define preprocessor? Or does it maybe depend on the context? What are advantages/disadvantages for each method?

  6. How can I define a define in C? - Stack Overflow

    The question is if users can define new macros in a macro, not if they can use macros in macros.

  7. "Static const" vs "#define" for efficiency in C - Stack Overflow

    May 21, 2016 · Advantage and disadvantages of #define vs. constants? "static const" vs "#define" vs "enum" static const vs #define Lots of people talk about best practice and convention as well as give …

  8. c - "static const" vs "#define" vs "enum" - Stack Overflow

    Nov 4, 2009 · Which one is better to use among the below statements in C? static const int var = 5; or #define var 5 or enum { var = 5 };

  9. c++ - What does ## in a #define mean? - Stack Overflow

    In other words, when the compiler starts building your code, no #define statements or anything like that is left. A good way to understand what the preprocessor does to your code is to get hold of the …

  10. Is there a way to do a #define inside of another #define?

    Is there a way to do a #define inside of another #define? Asked 15 years, 6 months ago Modified 7 years ago Viewed 59k times