473,372 Members | 1,374 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

What's the usage?

ikl
What's the usage of #ifdef and #endif in the code below?

#ifdef C_DEF
class C
{
public:
void Repair();
};

void C::Repair () {
....
}
#endif

Since I understand using like:

#ifdef C_DEF
class C
{
public:
void Repair();
};
#endif

void C::Repair () {
....
}
Thanks!
Jul 22 '05 #1
6 1567

"ikl" <ik***@dsp.com> wrote in message
news:PM********************@bgtnsc05-news.ops.worldnet.att.net...
What's the usage of #ifdef and #endif in the code below?

#ifdef C_DEF
if the symbol 'C_DEF' is defined (with a #define directive),
then translate all the following code...
class C
{
public:
void Repair();
};

void C::Repair () {
...
}
.... until a
#endif
... directive is encountered.

Since I understand using like:

#ifdef C_DEF
class C
{
public:
void Repair();
};
#endif
This is the same as above, except it doesn't
include the definition of the member function
'Repair()'.

void C::Repair () {
A class 'C' must be visible at this point for
this to be valid.
...
}

Look up 'preprocessor directives' in your C++ book.

-Mike
Jul 22 '05 #2

"ikl" <ik***@dsp.com> wrote in message
news:PM********************@bgtnsc05-news.ops.worldnet.att.net...
What's the usage of #ifdef and #endif in the code below?

#ifdef C_DEF
if the symbol 'C_DEF' is defined (with a #define directive),
then translate all the following code...
class C
{
public:
void Repair();
};

void C::Repair () {
...
}
.... until a
#endif
... directive is encountered.

Since I understand using like:

#ifdef C_DEF
class C
{
public:
void Repair();
};
#endif
This is the same as above, except it doesn't
include the definition of the member function
'Repair()'.

void C::Repair () {
A class 'C' must be visible at this point for
this to be valid.
...
}

Look up 'preprocessor directives' in your C++ book.

-Mike
Jul 22 '05 #3
#ifdef and #endif are used for conditional compilation.
If C_DEF is defined, then compile in the class C and its
public member functions.

If C_DEF is not defined, then class C is
not included. Then of course you dont want to include
the
void C::Repair () {
....
}
member function, since its an error.

What's the usage of #ifdef and #endif in the code below?

#ifdef C_DEF
class C
{
public:
void Repair();
};

void C::Repair () {
...
}
#endif

Since I understand using like:

#ifdef C_DEF
class C
{
public:
void Repair();
};
#endif

void C::Repair () {
...
}
Thanks!


Jul 22 '05 #4
#ifdef and #endif are used for conditional compilation.
If C_DEF is defined, then compile in the class C and its
public member functions.

If C_DEF is not defined, then class C is
not included. Then of course you dont want to include
the
void C::Repair () {
....
}
member function, since its an error.

What's the usage of #ifdef and #endif in the code below?

#ifdef C_DEF
class C
{
public:
void Repair();
};

void C::Repair () {
...
}
#endif

Since I understand using like:

#ifdef C_DEF
class C
{
public:
void Repair();
};
#endif

void C::Repair () {
...
}
Thanks!


Jul 22 '05 #5
JaSeong Ju wrote:
<A top-posted message.>

Please stop top-posting. Read section 5 of the FAQ (which you should
have already read) for posting guidelines:

http://www.parashift.com/c++-faq-lite/

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
Jul 22 '05 #6
JaSeong Ju wrote:
<A top-posted message.>

Please stop top-posting. Read section 5 of the FAQ (which you should
have already read) for posting guidelines:

http://www.parashift.com/c++-faq-lite/

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.
Jul 22 '05 #7

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

Similar topics

7
by: Jonathan Fine | last post by:
Giudo has suggested adding optional static typing to Python. (I hope suggested is the correct word.) http://www.artima.com/weblogs/viewpost.jsp?thread=85551 An example of the syntax he proposes...
5
by: John Smith | last post by:
I am writing a program which should keep running if not interrupted. While testing the program, I noticed that when the program was first run, the cpu usage (on WinXP) was between 0 to 2 %. In the...
8
by: GeekBoy | last post by:
I understand the benefit of pushing the StateServer process onto another computer to "balance" the load and take some cpu and memory usage off the web server, but how much could it possibly help?...
15
by: dee | last post by:
Hi, What is the maximum number of minutes for Session timeout that I can specify in web.config? Thanks. Dee
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
7
by: Leonel Gayard | last post by:
Hi all, I had to write a small script, and I did it in python instead of shell-script. My script takes some arguments from the command line, like this. import sys args = sys.argv if args ==...
10
by: rdemyan via AccessMonster.com | last post by:
My app contains utility meter usage. One of the things we have to deal with is when a usage is clearly incorrect. Perhaps someone wrote the meter reading down incorrectly or made a factor of 10...
3
by: Sirisha | last post by:
I am using the following code to get the CPU usage PerformanceCounter myCounter; myCounter = new PerformanceCounter(); myCounter.CategoryName = "Processor"; myCounter.CounterName = "%...
2
by: Sin Jeong-hun | last post by:
In short, is there any way to know the very code that is currently hogging the CPU? I've written an application which continously GETting web pages using HttpWebRequest's asynchronous methods...
93
by: lorlarz | last post by:
Here, let's see what you JavaScript programmers have got Here is a place to share your large or larger full-blown JavaScript applications: real.comp.lang.js.apps (a new google group) Here is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.