Hi Devs,

I've noticed that we define macros (e.g. VERIFY_SUCCESS, and similar) in 
several places, usually in the source file where it's being used.  This seems 
like a maintenance burden and bug risk (if two implementations differ, it might 
lead a developer to make a mistake).  It also can lead to collisions when the 
macro appears in a header and source file.

One approach would be to wrap the macros in #ifndef //macro #endif blocks, to 
resolve potential collisions, but again this seems error-prone, as a dev may 
not know which version is actually being used when calling.

Another approach would be to wrap the macros in local source files with #ifdef 
#undef // macro #endif blocks to ensure the locally-defined version is used.

Another approach is to remove the implementations from source files entirely 
and place in a shared "verifymacros.h" header file, but this would touch a lot 
of files.

I'm sure there are others, too...

Any thoughts?


iotivity-dev mailing list

Reply via email to