C++ Logo

std-discussion

Advanced search

Re: Undefining a compiler 's predefined macro

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Sun, 22 Mar 2020 16:11:47 +0200
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.

Received on 2020-03-22 09:14:48