Re: what will be the value of #define
- From: "santosh" <santosh.k83@xxxxxxxxx>
- Date: 3 Mar 2007 02:49:14 -0800
Keith Thompson wrote:
"raghu" <ragavakumar@xxxxxxxxx> writes:
On Mar 2, 6:28 pm, mark_blue...@xxxxxxxxx wrote:
<snip>
To explain a little more for "raghu" - the approach is a standard
convention for ensuring that multiple inclusions of header files
(usually due to being nested in other header files) are "harmless".
If my header called "fred.h" has the form:-
#ifndef FRED_H
#define FRED_H
...
#endif /*FRED_H*/
then the first inclusion will have the macro "FRED_H" undefined, will
define the macro (as an empty macro) and do the other declarations,
definitions etc which the header defines.
Any subsequent inclusions will have "FRED_H" defined, so will do
nothing.
Yes you are correct. I am imlementing exactly like this but one thing
I didn't understand what will be the value assigned FRED_H here. when
the processor looks in to it their must be change in the value. Right.
what will be that value.
Thanks for ur reply.
<snip>
Given
#define SYSTEM_H
the identifier SYSTEM_H is a macro that expands to nothing. Any uses
of it *outside a preprocessing directive* (such as #if or #ifdef) will
simply vanish. For example, this:
SYSTEM_H int x SYSTEM_H = 42 SYSTEM_H ;
is exactly equivalent to this:
int x = 42 ;
A minor question:
Is it simply removed or is it replaced by a space character?
<snip>
.
- Follow-Ups:
- Re: what will be the value of #define
- From: Eric Sosman
- Re: what will be the value of #define
- References:
- what will be the value of #define
- From: raghu
- Re: what will be the value of #define
- From: Eric Sosman
- Re: what will be the value of #define
- From: mark_bluemel
- Re: what will be the value of #define
- From: raghu
- Re: what will be the value of #define
- From: Keith Thompson
- what will be the value of #define
- Prev by Date: Re: what will be the value of #define
- Next by Date: Re: Atomic line-reading without buffering
- Previous by thread: Re: what will be the value of #define
- Next by thread: Re: what will be the value of #define
- Index(es):
Relevant Pages
|