Path: csiph.com!news.mixmin.net!eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.lang.c++ Subject: Re: CHAR_BIT is not eight Date: Mon, 05 Dec 2022 11:42:49 -0800 Organization: A noiseless patient Spider Lines: 56 Message-ID: <86359t63ie.fsf@linuxsc.com> References: <361b04cd-8be4-48c5-bc78-229f145eb343n@googlegroups.com> <86r0y3c8yg.fsf@linuxsc.com> <87mt8qkan0.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader01.eternal-september.org; posting-host="2ddce67c8b282e4376f4acd679e971ad"; logging-data="31465"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19f89bqtob1giwybwOOT/7L4I+d/1cw//A=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:PwYulTfdP4Ovmixs/2sSLtv+v3k= sha1:3kmH3NADobK7jc1w9/DQ0mq6UHM= Xref: csiph.com comp.lang.c++:87704 Keith Thompson writes: > Tim Rentsch writes: > >> Paavo Helde writes: >> >>> 14.10.2022 08:54 Juha Nieminen kirjutas: >>> >>>> David Brown wrote: >>>> >>>>> It is very rare that "as portable as possible" is a realistic >>>>> specification. It happens, but it is not common. >>>> >>>> "Not common" does not mean "you shouldn't care", when you are writing >>>> a library that could potentially be used in more exotic architectures, >>>> such as the one mentioned in this thread. >>>> >>>> For example if you are writing, say, a small library that >>>> calculates hashes or checksums using a particular algorithm. It's >>>> not at all unrealistic that such a library could have uses in these >>>> more exotic microcontrollers (as microcontrollers are often used in >>>> embedded systems that handle data somehow, and might be interested >>>> in calculating things like checksums and hashes). And it is quite >>>> likely that such an algorithm might care about bit sizes. >>> >>> True, but for really supporting such exotic platforms one would need >>> to run tests on these platforms (or at least in an emulator) during >>> the development and potentially also later if anything changes. >> >> Perhaps some tests, but not necessarily all tests. Any parts of >> the program that are verifiably platform agnostic would not need >> platform-specific re-testing. Also, any platform-specific tests >> don't have to be run during development, but only just before the >> program is deployed on the exotic platforms in question, which >> could be significantly later than the original development. > > How do you know that a part of program is "verifiably platform > agnostic" without platform-specific testing? How else would that > be verified? Testing can be used to show the presence of bugs, but never their absence. The same principle applies to determining whether code is platform agnostic. Showing that part of a program is platform agnostic can be done using formal methods and formal semantics, just like other kinds of formal verification. It can be more work to take into account the range of variation allowed by platform variability, but the principles involved are the same. >>> Software without tests is just a work of literature. >> >> A hyperbolic statement if ever there was one. > > Sure, but only slightly hyperbolic. On the contrary, more hyperbolic than most. That is the meaning of the sentence "a hyperbolic statement if ever there was one."