On Tue, Jan 30, 2018 at 2:36 PM, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Duy Nguyen <pclouds@xxxxxxxxx> writes: > >> Is it simpler (though hacky) to just do >> >> #ifdef __cplusplus >> #define new not_new >> #define try really_try >> ... >> >> somewhere in git-compat-util.h? > > Very tempting, especially given that your approach automatically > would cover topics in flight without any merge conflict ;-) > > I agree that it is hacky and somewhat ugly, but the hackiness > somehow does not bother me too much in this case; perhaps because > attempting to use a C++ compiler may already be hacky in the first > place? > > It probably depends on the reason why we are doing this topic. If a > report about our source code coming from the C++ oriented tool cite > the symbol names seen by machines, then the "hacky" approach will > give us "not_new" where Brandon's patch may give us "new_oid", or > whatever symbol that is more appropriate for the context it appears > than such an automated cute name. > >> Do we use any C features that are incompatible with C++? (or do we not >> need to care?) > > Good question. implicit casts from void? e.g. xmalloc returns a void pointer, not the type requested. https://embeddedartistry.com/blog/2017/2/28/c-casting-or-oh-no-we-broke-malloc