preprocessor-directive Questions
4
Solved
I see this being done all the time for example in the Linux kernel. What is the purpose of using the preprocessor commands vs. just normal C++ if else block? Is there a speed advantage or something...
Gardiner asked 6/4, 2014 at 18:13
7
Solved
What's the meaning of #line in the C language? Where would it be used?
Platus asked 7/2, 2010 at 9:29
19
In C/C++/Objective C you can define a macro using compiler preprocessors.
Moreover, you can include/exclude some parts of code using compiler preprocessors.
#ifdef DEBUG
// Debug-only code
#endif
...
Gynandrous asked 2/6, 2014 at 21:6
7
First off, I want it to stop on warnings. But I also want to print out some informative messages (like "Come back and implement this!").
Unfortunately, my compiler doesn't support #info, ...
Kosak asked 6/12, 2010 at 22:48
5
Solved
CHow can I correctly provide the following functionally from C# in Java?
[C#]
#define PRODUCTION //Change from sandbox to production to switch between both systems.
#if SANDBOX
using NetSuite.com...
Gilmer asked 12/12, 2013 at 14:50
6
Solved
Are there any C++ compile time macros which exists to detect which Windows OS the code is being compiled on. I basically want to support certain functions only on Win7. So I am interested in doing ...
Moberg asked 11/4, 2012 at 18:46
4
Solved
Here's a concrete example of what I want to do.
Consider the string.Join function. Pre-.NET 4.0, there were only two overloads, both of which required a string[] parameter.
As of .NET 4.0, there ...
Hemostat asked 26/12, 2010 at 22:11
5
What is the difference between the 2 following code lines?
#define F_SAMP 10000.0f
#define F_SAMP 10000.0
Aren't both float? (By the way, in this particular case compiler is XC16 but I do not...
Pili asked 10/1, 2022 at 1:13
3
Solved
A simple question that Google doesn't help me with. Is it legal in C++ to use #elif clause in the context of #ifdef? It seems to compile and work as expected with all the major compilers in the c++...
Caricature asked 31/10, 2017 at 22:48
4
Solved
(I am working on a SDK wherein I have the code of the particular SDK in reference and I am not able to trace out the flow of the program.)
What does
#if defined (AR7x00)
mean? Specifically, wh...
Institutor asked 27/1, 2014 at 8:0
4
Solved
My compiler expands it to 199711L. What does that mean? I read that __cplusplus > 199711L signifies C++11. What are the possible expansions of this macro and what does it signify?
Dropkick asked 15/6, 2012 at 15:40
4
Solved
In C++ there are predefined macros:
#if defined(_M_X64) || defined(__amd64__)
// Building for 64bit target
const unsigned long MaxGulpSize = 1048576 * 128;// megabyte = 1048576;
const unsigned l...
Tender asked 28/1, 2015 at 2:6
3
I added TEST=1 in the Preprocessor Macros section of the project target's Build Settings, and whenever I use it in code, the preprocessor thinks it's not defined.
alt + click on it shows a questi...
Anastos asked 2/3, 2017 at 12:6
4
I would like to attach MyNamespace:: to the function defined by the macro:
#define transFunc(func) \
dimensionedScalar func(const dimensionedScalar& ds) \
{ \
if (!ds.dimensions().dimensionle...
Grizzle asked 8/12, 2014 at 15:23
3
Solved
#include <iostream>
int main()
{
int value1 = 1, value2 = 10;
std::cout << "Min = " << std::min(value1,value2) <<std::endl;
std::cout << "Max = " << std::max...
Sallysallyann asked 11/11, 2013 at 1:57
2
Solved
Here is the full program. Can you figure out its console output?
#import <Foundation/Foundation.h>
#define kEnv YES
#if kEnv
#define x @"abc"
#else
#define x @"xyz"
#end...
Succulent asked 31/12, 2020 at 7:4
3
Solved
In MSVC & C#, #pragma region can be used to label a code section.
Similarly, in GCC/Clang, #pragma mark can accomplish the same thing.
Is it possible to define a single macro such as CODELABEL...
Poise asked 8/9, 2015 at 23:34
1
Solved
Swift 4.2 has a special condition canImport that helps developers to check whether a module can be imported in project. It was introduced in Swift 4.1.
Now I am working on iOS project written in O...
Neutrality asked 2/10, 2018 at 9:8
1
Solved
I was reading the Microsoft webpage https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/preprocessor-directives/preprocessor-line about #line directives in C#. It explains that the #...
Miscarry asked 22/9, 2020 at 0:53
1
I created a small application which targets two frameworks (.net core 2.2 and .net core 3.0) and uses target framework symbols (NETCOREAPP2_2 and NETCOREAPP3_0).
The project file is very simple an...
Jahveh asked 9/12, 2019 at 13:23
1
Solved
The Problem
I have a child component that may or may not exist on the page with a v-if. Trying to keep it cached when the user has clicked other things so that search terms and whatnot show up agai...
Calvin asked 20/1, 2020 at 6:43
6
Solved
I'm using an open source library which seems to have lots of preprocessing directives to support many languages other than C. So that I can study what the library is doing I'd like to see the C cod...
Caracalla asked 4/2, 2011 at 17:18
3
Solved
Here is my example code https://godbolt.org/z/VKgKik
#define delete MyCustomDelete(__FILE__, __LINE__), delete
#define CAT(X,Y) CAT2(X,Y)
#define CAT2(X,Y) X##Y
#define CAT_3(X,Y,Z) CAT(X,CAT(Y,Z...
Unprovided asked 8/5, 2019 at 16:57
7
Solved
What does the following line do?
#line 25 "CSSGrammar.y"
And what's with the extension?
Mountford asked 5/2, 2012 at 20:46
3
I've been writing an #if DEBUG, #else, #endif fragment of code, and I noticed that Visual Studio doesn't let me use autocomplete to fulfill partially typed member names, and it doesn't check the gr...
Recruit asked 2/4, 2018 at 11:56
1 Next >
© 2022 - 2025 — McMap. All rights reserved.