#define

I

Ivan

Hi all,

What is the scope of preprocessor #define?
Does it depends on the compiler?

Thanks
Ivan
 
V

vippstar

Hi all,

What is the scope of preprocessor #define?
Does it depends on the compiler?

anything below the #define line until the end of file, it does not
depend from the compiler.
 
M

Malcolm McLean

Ivan said:
What is the scope of preprocessor #define?
Does it depends on the compiler?
File scope, in all conforming implementations. However #defines are
frequently placed in headers which are #included by more than one dot c
file.

Some compilers separate out the preprocessing step from compilation proper.
Preprocessing manages the instructions that start with a hash. However this
will be transparent to you unless you invoke the preprocessor only
(typically the command is cpp or similar).
 
R

robertwessel2

From that point on to the end of the file, or to a corresponding #undef
if there is one.


More precisely to the end of the translation unit (or #undef). "End
of the file" is somewhat ambiguous during preprocessing without
additional qualification.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top