[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Removing some workarounds for big integers
From: |
Philipp Stephani |
Subject: |
Re: Removing some workarounds for big integers |
Date: |
Sun, 9 Aug 2020 18:13:11 +0200 |
Am So., 9. Aug. 2020 um 17:39 Uhr schrieb Philipp Stephani
<p.stephani2@gmail.com>:
>
> >
> > To work around this problem, the macro could have another argument, being
> > the
> > lvalue destination; that would avoid these problems. However, it'd be more
> > awkward to use. At some point it's easier to avoid the macro and use the
> > underlying functions.
>
> I wouldn't agree to that. The large advantage of packaging the
> conversion up into a single macro is that the range check is always
> correct and only needs to be coded once. Repeating the range check for
> each caller is rather error-prone. So I think a void-returning macro
> makes sense. It wouldn't even need another argument, as the type
> follows from the destination. (At least if __typeof__ is available.)
Actually it might be easier to enumerate all integer types using
_Generic. Since we now require C11, that should always be available.