473,549 Members | 2,615 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Preprocessor

I have never really used the preprocessor commands so this may seem like a
newbie question.

In my development code, I short circuit certain variables being set by
hardcoding them. So for example I would say something like

PlanID = 1;

However, in the production code, PlanID comes already assigned to me and if
I keep this assignment, I will be using the wrong PlanID.

So if I use

#define DEBUG
:
:

#if DEBUG
PlanID = 1;
#endif

This works great.

HOWEVER......
I would like to have one DEBUG definition to use for the whole project.
What is the best way to do this?

Thanks.

Steve
Nov 15 '05 #1
3 1243
I would like to have one DEBUG definition to use for the whole project.
What is the best way to do this?


Csc.exe /d:DEBUG

if you're using the command line compiler, or set it in the project
properties in VS.NET.

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 15 '05 #2
Hi Steve,

Add the /define:DEBUG switch during compilation or add the DEBUG
symbol in the Conditional Compilation Constants in the property pages
for the project. (AFAIK the DEBUG symbol would already be defined by
default for debug builds)

Regards,
Nalin Perera.

"Steve" <steve@I_dont_n eed_no_stickin_ penis_pills.com > wrote in message news:<e5******* ******@tk2msftn gp13.phx.gbl>.. .
I have never really used the preprocessor commands so this may seem like a
newbie question.

In my development code, I short circuit certain variables being set by
hardcoding them. So for example I would say something like

PlanID = 1;

However, in the production code, PlanID comes already assigned to me and if
I keep this assignment, I will be using the wrong PlanID.

So if I use

#define DEBUG
:
:

#if DEBUG
PlanID = 1;
#endif

This works great.

HOWEVER......
I would like to have one DEBUG definition to use for the whole project.
What is the best way to do this?

Thanks.

Steve

Nov 15 '05 #3
You guys are the best. Exactly what I needed. Thanks.

Steve


"Steve" <steve@I_dont_n eed_no_stickin_ penis_pills.com > wrote in message
news:e5******** *****@tk2msftng p13.phx.gbl...
I have never really used the preprocessor commands so this may seem like a
newbie question.

In my development code, I short circuit certain variables being set by
hardcoding them. So for example I would say something like

PlanID = 1;

However, in the production code, PlanID comes already assigned to me and if I keep this assignment, I will be using the wrong PlanID.

So if I use

#define DEBUG
:
:

#if DEBUG
PlanID = 1;
#endif

This works great.

HOWEVER......
I would like to have one DEBUG definition to use for the whole project.
What is the best way to do this?

Thanks.

Steve

Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

205
10468
by: Jeremy Siek | last post by:
CALL FOR PAPERS/PARTICIPATION C++, Boost, and the Future of C++ Libraries Workshop at OOPSLA October 24-28, 2004 Vancouver, British Columbia, Canada http://tinyurl.com/4n5pf Submissions
24
40085
by: Nudge | last post by:
I have an array, and an unrolled loop which looks like this: do_something(A); do_something(A); .... do_something(A); I thought: why should I type so much? I should write a macro. So I was looking to write something along the lines of:
16
4474
by: Trying_Harder | last post by:
Is it possible to redefine a macro with global scope after undefining it in a function? If yes, could someone explain how? /If/ my question above isn't very clear you can refer to the following example. eg cosider 2 files sample.c and sample.h sample.h
13
3562
by: seemanta dutta | last post by:
Greetings C gurus, I have used preprocessor directives since a very long time. But whenever I see some professional piece of C code, the linux kernel for example, I get literally confused by the amount of preprocessor directives used in these code. Can anyone please tell me how to actually use these preprocessor directives in a more...
18
3006
by: /* frank */ | last post by:
My teacher said that array in C is managed by preprocessor. Preprocesser replace all array occurences (i.e. int a ) with something that I don't understand/remember well. What's exactly happens with array during preprocessing/compiling stage? Thanks in advance
13
2106
by: Chris Croughton | last post by:
Is the following code standard-compliant, and if so what should it do? And where in the standard defines the behaviour? #include <stdio.h> #define DEF defined XXX int main(void) { int defined = 2;
9
3645
by: Walter Roberson | last post by:
I have run into a peculiarity with SGI's C compiler (7.3.1.2m). I have been reading carefully over the ANSI X3.159-1989 specification, but I cannot seem to find a justification for the behaviour. Could someone point me to the appropriate section, or else confirm the behaviour as a bug? For a particular project, I am using the C preprocessor...
2
6626
by: Paolo | last post by:
I imported a VC++6.0 project into VC++7.1. The conversion operation makes a mess with Preprocessor Definitions, adding a "$(NoInherit)" for each file. For example: I had a DLL project in VC++6.0 where the definitions were: _UNICODE,_DEBUG,_WIN32_DCOM,WIN32,_WINDOWS,_WINDLL,_AFXDLL,_USRDLL In VC++7.1, these are the preprocessor definitions...
32
2744
by: spibou | last post by:
Is the output of the C preprocessor deterministic ? What I mean by that is , given 2 compilers which conform to the same standard, will their preprocessors produce identical output given as input the same file ? If not then how much variation is allowed ? Is it just a bit more or less white space here and there or could could there be larger...
31
2887
by: Sam of California | last post by:
Is it accurate to say that "the preprocessor is just a pass in the parsing of the source file"? I responded to that comment by saying that the preprocessor is not just a pass. It processes statements that the compiler does not process. The good people in the alt.comp.lang.learn.c-c++ newsgroup insist that the preprocessor is just one of...
0
7451
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7720
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7473
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6044
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3501
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3483
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1944
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1061
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
764
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.