On 5/1/20 4:13 PM, Bruno Haible wrote:
> For subtraction, I would not define anything - I see no use for subtracting
> possibly overflown values.
That would simplify things. I assume we would want saturated multiplication,
though. And we could use INT_ADD_SAT (INT_MULTIPLY_SAT (m, n), -1) to comp
Paul Eggert wrote:
> > I'm open to this. What prefix would you propose instead of 'x'?
>
> The usual English-language name for this sort of thing is "saturation
> arithmetic", but SATURATED_ADD is kind of long. LLVM uses "sat" for saturated
> operations, perhaps the prefix "SAT" will do.
Fine wit
On 5/1/20 2:09 AM, Bruno Haible wrote:
> I'm open to this. What prefix would you propose instead of 'x'?
The usual English-language name for this sort of thing is "saturation
arithmetic", but SATURATED_ADD is kind of long. LLVM uses "sat" for saturated
operations, perhaps the prefix "SAT" will do.
On 5/1/20 2:20 AM, Marc Nieper-Wißkirchen wrote:
> I think that size_t calculations are still the most important ones.
In other apps I've found many other integer types where overflow is important,
including ptrdiff_t, int, long, and intmax_t. ptrdiff_t is the big one, as its
use is supplanting si
Am Fr., 1. Mai 2020 um 11:09 Uhr schrieb Bruno Haible :
>
> Paul Eggert wrote:
> > I realize we have dueling conventions here, but would prefer that
> > saturated size_t arithmetic have a longer prefix or suffix than just "x".
>
> I'm open to this. What prefix would you propose instead of 'x'?
Wha
Paul Eggert wrote:
> I realize we have dueling conventions here, but would prefer that
> saturated size_t arithmetic have a longer prefix or suffix than just "x".
I'm open to this. What prefix would you propose instead of 'x'?
Generally, 'xsize' has not caught on as I had expected. It is still a
Am Fr., 1. Mai 2020 um 00:20 Uhr schrieb Paul Eggert :
>
> On 4/30/20 2:01 PM, Marc Nieper-Wißkirchen wrote:
>
> #define XFLEXSIZEOF_XSIZE(type, member, n) \
> (((n) <= FLEXSIZEOF (type, member, n) \
> && FLEXSIZEOF (type, member, n) <= (size_t) -1) \
> ? (size_t) FLEXS
On 4/30/20 2:01 PM, Marc Nieper-Wißkirchen wrote:
#define XFLEXSIZEOF_XSIZE(type, member, n) \
(((n) <= FLEXSIZEOF (type, member, n) \
&& FLEXSIZEOF (type, member, n) <= (size_t) -1) \
? (size_t) FLEXSIZEOF (type, member, n) : (size_t) -1)
>
> Why do you write "(n) <=
Am Do., 30. Apr. 2020 um 22:49 Uhr schrieb Paul Eggert :
>
> On 4/29/20 11:39 PM, Marc Nieper-Wißkirchen wrote:
>
> >> #define XFLEXSIZEOF_XSIZE(type, member, n) \
> >> (((n) <= FLEXSIZEOF (type, member, n) \
> >> && FLEXSIZEOF (type, member, n) <= (size_t) -1) \
> >>? (size_t) FLEXSIZEOF
On 4/29/20 11:39 PM, Marc Nieper-Wißkirchen wrote:
>> #define XFLEXSIZEOF_XSIZE(type, member, n) \
>> (((n) <= FLEXSIZEOF (type, member, n) \
>> && FLEXSIZEOF (type, member, n) <= (size_t) -1) \
>>? (size_t) FLEXSIZEOF (type, member, n) : (size_t) -1)
>>
>> A couple of problems with this
Thank you very much for your quick response!
Am Do., 30. Apr. 2020 um 00:39 Uhr schrieb Paul Eggert :
>
> On 4/29/20 12:29 PM, Marc Nieper-Wißkirchen wrote:
> > It would be great if the flexmember exported another macro, say
> > XFLEXSIZEOF, which returned SIZE_MAX in case of arithmetic overflow.
On 4/29/20 12:29 PM, Marc Nieper-Wißkirchen wrote:
> It would be great if the flexmember exported another macro, say
> XFLEXSIZEOF, which returned SIZE_MAX in case of arithmetic overflow.
Something like this?
/* Like FLEXSIZEOF, except yield SIZE_MAX on arithmetic overflow,
and N might be eval
The flexmember module provides the macro FLEXSIZEOF to calculate an
appropriate size to malloc a struct with a flexible array member.
Overflow is reported differently than with the xsize module, which
provides size_overflow_p.
It would be great if the flexmember exported another macro, say
XFLEXS
13 matches
Mail list logo