Re: [PATCH 00/37] removal of some c++ keywords
- From
Stefan Beller <sbeller@google.com>
- Date
- Jan 30, 2018, 23:01 UTC
- Message-ID
- <CAGZ79kZ-hZzKtv05d5_7O2ndNZvGkU7qYnrn52zwpqSTqCiygQ@mail.gmail.com>
- In-Reply-To
- <xmqq7erzrn3f.fsf@gitster-ct.c.googlers.com>
On Tue, Jan 30, 2018 at 2:36 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 30 quoted lines
> Duy Nguyen <pclouds@gmail.com> 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