Why do some include guards have a defined value? -
Why do some include guards have a defined value? -
usually when using include guards write them so:
#ifndef filename_h #define filename_h ... #endif // filename_h
now in librarys i've seen like:
#ifndef filename_h #define filename_h 1 ... #endif // filename_h
after reserach didn't find reason why include-gurad needed initialized.
is there reason doing this?
though i've never seen such compiler, i've been told "empty" define regarded not defined. i'm interested in compiler behaves so.
even c89 states: 3.8.1 conditional inclusion constraints
the look controls conditional inclusion shall integral constant look [...] of form
defined identifier
defined ( identifier )
which evaluate 1 if identifier defined macro name (that is, if predefined or if has been subject of #define preprocessing directive without intervening #undef directive same subject identifier), 0 if not.
include include-guards
Comments
Post a Comment