While looking at the poco library i saw some macros which has same identifier as well as the replacemente text:
for example in the file XML/inlucde/XML/expat.h
47 XML_STATUS_ERROR = 0,
48 #define XML_STATUS_ERROR XML_STATUS_ERROR
49 XML_STATUS_OK = 1,
50 #define XML_STATUS_OK XML_STATUS_OK
51 XML_STATUS_SUSPENDED = 2
52 #define XML_STATUS_SUSPENDED XML_STATUS_SUSPENDED
I was wondering what could be the use of defining macros like that.
I can think of two use cases here:
#defined somewhere else before. You don’t want to use value it was defined to, right? So here, you ensure that code using that identifiers will be valid.#ifdefing the identifiers (i.e. check if they were already defined).