About 11,900,000 results
Open links in new tab
  1. What is the purpose of the #define directive in C++?

    May 10, 2010 · 0 in C or C++ #define allows you to create preprocessor Macros. In the normal C or C++ build process the first thing that happens is that the PreProcessor runs, the …

  2. c# - How do you use #define? - Stack Overflow

    Oct 30, 2013 · The main use-case for #define is for conditional compilation (where it can be very useful). You're correct that using #define for symbols and (please don't do it) macros, is not a …

  3. MSBuild: set a specific preprocessor #define in the command line

    Our solution was to use an environment variable with /D defines in it, combined with the Additional Options box in Visual Studio. In Visual Studio, add an environment variable macro, …

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

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

  5. How do I show the value of a #define at compile-time?

    I know that this is a long time after the original query, but this may still be useful. This can be done in GCC using the stringify operator "#", but it requires two additional stages to be defined first. …

  6. Difference between `constexpr` and `#define` - Stack Overflow

    Feb 12, 2021 · 23 So I read the interesting answers about what are the differences between constexpr and const but I was curious about are the differences between #define and …

  7. c++ - Declaring a function using #define - Stack Overflow

    Jul 9, 2018 · The #define version is still a macro. The code is expanded at the invocation site. It has all the expected problems (with macros) including namespace pollution and unexpected …

  8. Define a 'for' loop macro in C++ - Stack Overflow

    Perhaps it is not good programming practice, but is it possible to define a for loop macro? For example, #define loop(n) for(int ii = 0; ii < n; ++ ii) works perfectly well, but does not give ...

  9. c++ - const string vs. #define - Stack Overflow

    The preprocessor should only be used for include guards, __FILE__ and similar built-in macros, and #ifdefs for platform-specific constants. While you can use it for defining constants actually …

  10. dot source - In PowerShell, how do I define a function in a file and ...

    May 16, 2011 · I have a .ps1 file in which I want to define custom functions. Imagine the file is called MyFunctions.ps1, and the content is as follows: Write-Host "Installing functions" function …