C++ Logo

STD-DISCUSSION

Advanced search

Subject: Re: Undefining a compiler 's predefined macro
From: Edward Diener (eldlistmailingz_at_[hidden])
Date: 2020-03-22 09:29:36


On 3/22/2020 10:11 AM, Ville Voutilainen via Std-Discussion wrote:
> On Sun, 22 Mar 2020 at 15:58, Edward Diener via Std-Discussion
> <std-discussion_at_[hidden]> wrote:
>
>> The general reason, since you seem curious, is that the codebase has
>> many instances of testing the predefined macro for one-off workarounds
>> for the particular compiler, which was not C++ standard compliant in a
>> number of cases. But with some change in the compiler implementation,
>> which can be easily detected in general in a single place in the code,
>> the one-off workarounds are no longer needed. Rather than have to change
>> the codebase to do the same detection in all the other places where the
>> predefined macro is being used, so as not to do the prescribed
>> workaround for the compiler implementation, it would be much easier to
>> undefine the predefine macro when it is detected in the single place in
>> the code.
>
> So detect the predefine in one place and define your own macro in that
> place depending on the predefine,
> and use your own macro elsewhere.

Exactly the original plan ! But this means in all the places where the
predefined macro was being used the code has to be changed to use my own
macro. Although that does not seem like it should be much work, the
places the predefined macro are being used are maintained by others in
git submodules, a PR has issued by me for each submodule, and then the
maintainer of each submodule has to make the change to that submodule at
his own leisure. Obviously the change itself is very simple. Whereas if
I could have undefined the predefined macro when I know in the code it
no longer has validity for all those other places, no change in the
other code in those various submodules would have to be done at all.


STD-DISCUSSION list run by std-discussion-owner@lists.isocpp.org

Older Archives on Google Groups