What is the use of ifndef? Why it is always used with
define?
In reply to VigneshPN :
I don’t understand your question. Conditional compile directive (ifdef and
ifndef) can only test for the existence or non-existance of a `define macro. The two forms just reverse the polarity of the two branches.
The question isn’t clear.
I think he is referring to include_guards… If so, please refer to this thread ::
https://verificationacademy.com/forums/ovm/why-ifndef-and-define-are-used-together
In the C and C++ programming languages, an #include guard, sometimes called a macro guard, header guard or file guard, is a particular construct used to avoid the problem of double inclusion when dealing with the include directive.
The C preprocessor processes directives of the form #include <file> in a source file by locating the associated file on disk and transcluding ("including") its contents into a copy of the source file known as the translation unit, replacing the include directive in t...