#define

format of #define token value like this // I know about in details
but in header file we use only
#define H_File_name [no value]
my question is what is initialized for H_File_name and how to know it
I am curious to know this.
It does not have a value. You can know that it is defined or not defined in various ways:

#ifdef SOMETHING

#ifndef SOMETHING

#if defined(SOMETHING)

#if !defined(SOMETHING)

You can also undefine values:
#undef SOMETHING
Last edited on
I see #define format from
http://en.cppreference.com/w/cpp/preprocessor/replace

but this no value format is not listed


how compiler work with this type of format.
Last edited on
it's listed now (replacement-list may be an empty list, so I marked it "optional").
To answer your question, every use of H_File_name is replaced with an empty list, and as LB correctly pointed out, you may check whether H_File_name names a macro using #ifdef/#ifndef or the defined operator
Last edited on
thnx both.
that means #if not work here.
1
2
3
#define token value
#ifdef -----work on token it check it is listed or not
#if ---------- work on value   

if I am wrong plz point out me.
Topic archived. No new replies allowed.