[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Reducing duplication of bit operation code.
From: |
Collin Funk |
Subject: |
Re: Reducing duplication of bit operation code. |
Date: |
Thu, 19 Dec 2024 18:09:01 -0800 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Hi Bruno,
Bruno Haible <bruno@clisp.org> writes:
> Also, I see that MSVC is not well covered by this default in stdbit.in.h:
>
> #else
> /* This platform is so old that it lacks typeof, so _Generic is likely
> missing or unreliable. The C23 standard seems to allow yielding B
> (which is always unsigned long long int), so do that. */
> # define _GL_STDBIT_TYPEOF_CAST(a, b) (b)
> #endif
>
> Can it be improved?
Good point.
I see that MSVC supports both typeof and __typeof__ since Visual Studio
17.9. The difference is 'typeof' requires compiling with the latest
language standard, but '__typeof__' can be used with any language
version [1].
I've applied the two attached patches to detect them in stdbit-h and
intprops using the _MSC_VER [2].
Collin
[1] https://learn.microsoft.com/en-us/cpp/c-language/typeof-c?view=msvc-170
[2]
https://learn.microsoft.com/en-us/cpp/overview/compiler-versions?view=msvc-170#version-macros
0001-stdbit-h-Detect-MSVC-__typeof__-support.patch
Description: Text Data
0002-intprops-Detect-MSVC-__typeof__-support.patch
Description: Text Data