| Deutsch English Français Italiano |
|
<va046r$2viks$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!2.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: chrisq <devzero@nospam.com> Newsgroups: comp.os.vms Subject: Re: New VSI post on Youtube Date: Mon, 19 Aug 2024 19:51:07 +0100 Organization: A noiseless patient Spider Lines: 57 Message-ID: <va046r$2viks$1@dont-email.me> References: <v9ehs5$3mqbj$1@dont-email.me> <v9idff$f9k4$1@dont-email.me> <v9iqln$hrs3$1@dont-email.me> <v9iro6$fql6$1@dont-email.me> <66bcf876$0$717$14726298@news.sunsite.dk> <66bcfbe3$0$717$14726298@news.sunsite.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Date: Mon, 19 Aug 2024 20:51:08 +0200 (CEST) Injection-Info: dont-email.me; posting-host="cb1b5f15369e7cfca1881e43532baf8e"; logging-data="3132060"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/Qw53PlCDEixwSSm4BErWM" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:OmUpIcskAY1DAlQ+QJ9yRPmllSY= In-Reply-To: <66bcfbe3$0$717$14726298@news.sunsite.dk> Content-Language: en-US Bytes: 2440 On 8/14/24 19:48, Arne Vajhøj wrote: > On 8/14/2024 2:33 PM, Arne Vajhøj wrote: >> And it has different size of long and pointers. Causing problems >> for two cases: >> * code that make implicit assumptions that those are 32 bit >> * mixing C and C++ > > I am getting more and more convinced that C and C++ > code should completely switch to the explicit length > model. > > So: > > #include <stdint.h> > > or: > > #include <cstdint> > > and use: > > int8_t > int16_t > int32_t > int64_t > uint8_t > uint16_t > uint32_t > uint64_t > > and consider putting: > > #define int ">>>> DO NOT USE INT <<<<" > #define short ">>>> DO NOT USE SHORT <<<<" > #define long ">>>> DO NOT USE LONG <<<<" > > in as well to enforce. > > Where did I put that asbestos suit to protect me > from the C/C++ crowd? > > :-) > > Arne > For years in embedded work here, there is always a header file, wordsize.h which aliases such as U8, U16, U32 etc, to the bit sizes of the types related to the cpu variant and tools in use. Pretty foolproof, and important for embedded work, where you often need to know the width of hardware registers, and the variables and pointers that interact with them... > >