[graphviz-interest] About ifdefs for custom defines in public headers (e.g. HAVE_STRING_H in cdt.h)
Kevin Funk <[email protected]> Thu, 20 Mar 2014 17:03:38 +0100
| Newsgroups | gmane.comp.video.graphviz |
|---|---|
| Message-ID | <2557703.fvT7Aszr3K@kerberos> |
Hey, I've noticed that since GraphViz 2.36.0 (I think) 'cdt.h' checks for HAVE_STRING_H and other defines. cdt.h is a public header that may be used in other applications. Relevant code: #ifdef HAVE_STRING_H #include <string.h> #else extern int memcmp _ARG_((const Void_t*, const Void_t*, size_t)); extern int strcmp _ARG_((const char*, const char*)); #endif So, if HAVE_STRING_H is not defined, this leads to problems like discussed in https://github.com/KDAB/GammaRay/issues/70. (Note: GammaRay uses libgraphviz and includes cdt.h) IMO, from a technical POV you shouldn't check against macros that you don't define yourself in publicly installed headers, which is the case for HAVE_STRING_H. Public headers should be self-contained and should not require an external user to define custom defines in order to make it work. Almost every external user of the library will now have to provide HAVE_STRING_H=1 in his build system to be able to compile this file. Are you aware of the issue? Do you need more details? Cheers -- Kevin Funk _______________________________________________ [email protected] http://lists.research.att.com/mailman/listinfo/graphviz-interest