Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #163037
| From | James Kuyper <jameskuyper@alumni.caltech.edu> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: #include <stdint.h> |
| Date | 2021-10-06 20:06 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <sjldm8$ne4$1@dont-email.me> (permalink) |
| References | (2 earlier) <86bl7vb24m.fsf@linuxsc.com> <874kdnw20s.fsf@nosuchdomain.example.com> <sjkj8l$e7e$1@dont-email.me> <sjl53p$8us$1@dont-email.me> <%cp7J.10367$yk1.4260@fx13.iad> |
On 10/6/21 6:14 PM, Branimir Maksimovic wrote: > On 2021-10-06, James Kuyper <jameskuyper@alumni.caltech.edu> wrote: ... >> In several locations, the standard says "The same representation and >> alignment requirements are meant to imply interchangeability as >> arguments to functions, return values from functions, and members of >> unions." >> >> There's several problems with that statement. Firstly, "are meant to >> imply" is weasel-wording. It could have said, more simply and >> forcefully, "implies". Secondly, the implication doesn't hold up under >> close examination. For instance, unsigned and signed arguments with the >> same alignment and same representation for positive values of the signed >> type could still be passed by different methods as arguments or return >> values, which would prevent them from being interchangeable. Finally, >> that wording only appears in informative footnotes, not in normative text. >> >> After raising this issue many times over a couple of decades, I finally >> got confirmation from Larry Jones in 2011 (at that time, secretary of >> the committee) that use of "are meant to imply" rather than "implies" >> was deliberate, because it was in fact understood that no such >> implication was correct. He also confirmed that the non-normative nature >> of that text was also deliberate - the committee did NOT want to mandate >> that the types be interchangeable, only to recommend that they be made >> interchangeable. > > Problem is that C does not defines exact type and representation. > New language have noted that mistake so they have exact representation, > even if that not corresponds to hardware. > C goed in a way to have performance and portability, which of course > you can't have both, you just have buggy programs :p No, that's a distinct issue. If the C standard were changed to explicitly specify the exact representation of every data type, and no other changes were made, it would still be perfectly legal, for instance, for an implementation to use different methods for passing signed and unsigned arguments; on an implementation that did so, they would not be interchangeable as arguments of or return values from functions, not even for values that are representable in both types. It's also not necessarily a problem with C. Different languages are designed for different purposes. C was designed to be efficiently implementable almost everywhere - at the cost of making it more difficult to port code from one implementation to another. Other languages consider it more important to be able to port code between any two implementations of the language, at the cost of the language not being efficiently implementable on all platforms. C has added the size-named integer types, which mitigates this problem somewhat.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
#include <stdint.h> SIMON <invalid@invalid.invalid> - 2021-06-13 23:08 +0100
Re: #include <stdint.h> Bart <bc@freeuk.com> - 2021-06-13 23:27 +0100
Re: #include <stdint.h> Bart <bc@freeuk.com> - 2021-06-13 23:57 +0100
Re: #include <stdint.h> Philipp Klaus Krause <pkk@spth.de> - 2021-06-14 09:03 +0200
Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-06-14 01:23 -0700
Re: #include <stdint.h> Philipp Klaus Krause <pkk@spth.de> - 2021-06-14 12:31 +0200
Re: #include <stdint.h> Bart <bc@freeuk.com> - 2021-06-14 11:54 +0100
Re: #include <stdint.h> James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-06-13 18:34 -0400
Re: #include <stdint.h> Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-06-13 23:34 +0100
Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-06-13 17:48 -0700
Re: #include <stdint.h> Philipp Klaus Krause <pkk@spth.de> - 2021-06-14 09:09 +0200
Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-06-14 01:24 -0700
Re: #include <stdint.h> Philipp Klaus Krause <pkk@spth.de> - 2021-06-14 12:30 +0200
Re: #include <stdint.h> Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-06-24 10:31 -0700
Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-06-24 11:28 -0700
Re: #include <stdint.h> Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-07-11 02:49 -0700
Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-07-11 15:30 -0700
Re: #include <stdint.h> Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-07-16 03:33 -0700
Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-07-16 12:31 -0700
Re: #include <stdint.h> Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-09-30 07:07 -0700
Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-09-30 08:42 -0700
Re: #include <stdint.h> Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-10-06 03:55 -0700
Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-06 07:06 -0700
Re: #include <stdint.h> James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-10-06 11:47 -0400
Re: #include <stdint.h> Andrey Tarasevich <andreytarasevich@hotmail.com> - 2021-10-06 09:35 -0700
Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-10-06 10:06 -0700
Re: #include <stdint.h> James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-10-06 17:40 -0400
Re: #include <stdint.h> Branimir Maksimovic <branimir.maksimovic@icloud.com> - 2021-10-06 22:14 +0000
Re: #include <stdint.h> James Kuyper <jameskuyper@alumni.caltech.edu> - 2021-10-06 20:06 -0400
Re: #include <stdint.h> Branimir Maksimovic <branimir.maksimovic@icloud.com> - 2021-10-07 02:15 +0000
Re: #include <stdint.h> Ben Bacarisse <ben.usenet@bsb.me.uk> - 2021-06-24 22:34 +0100
Re: #include <stdint.h> Öö Tiib <ootiib@hot.ee> - 2021-06-24 15:01 -0700
Re: #include <stdint.h> Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2021-06-24 15:26 -0700
Re: #include <stdint.h> Tim Rentsch <tr.17687@z991.linuxsc.com> - 2021-07-11 02:14 -0700
csiph-web