bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: doc: Add appendix about Gnulib history


From: Paul Eggert
Subject: Re: doc: Add appendix about Gnulib history
Date: Fri, 3 May 2024 23:32:03 -0700
User-agent: Mozilla Thunderbird

On 2024-05-03 17:14, Collin Funk wrote:
Also about this comment in intprops-internal.h:

     /* This include file assumes that signed types are two's complement without
        padding bits; the above macros have undefined behavior otherwise.
        If this is a problem for you, please let us know how to fix it for your 
host.
        This assumption is tested by the intprops-tests module.  */

If you want to check this at compile time I think this should work:

Not quite, because it doesn't check for padding bits. Also, your code assumes that preprocessor arithmetic works the same as runtime arithmetic. Although C23 guarantees this (because it guarantees two's complement) I don't think C17 and earlier do. If memory serves, they even allow mixed-runtime systems, where arithmetic is sometimes ones' complement and sometimes two's. (Almost nobody cares about this theoretical possibility of course, which is why the Gnulib manual says not to worry about it.)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]