Deutsch English Français Italiano |
<vrrvgp$1828d$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Janis Papanagnou <janis_papanagnou+ng@hotmail.com> Newsgroups: comp.lang.c Subject: The integral type 'byte' (was Re: Suggested method for returning a string from a C program?) Date: Mon, 24 Mar 2025 16:59:20 +0100 Organization: A noiseless patient Spider Lines: 38 Message-ID: <vrrvgp$1828d$1@dont-email.me> References: <vrd77d$3nvtf$2@dont-email.me> <868qp1ra5f.fsf@linuxsc.com> <vrdhok$47cb$2@dont-email.me> <20250319115550.0000676f@yahoo.com> <vreuj1$1asii$4@dont-email.me> <vreve4$19klp$2@dont-email.me> <20250319201903.00005452@yahoo.com> <86r02roqdq.fsf@linuxsc.com> <vrh1br$35029$2@dont-email.me> <LRUCP.2$541.0@fx47.iad> <vrh71t$3be42$1@dont-email.me> <vrh9vh$3ev9o$1@dont-email.me> <vrhct4$3frk8$2@dont-email.me> <20250320204642.0000423a@yahoo.com> <vrhphb$3s62l$1@dont-email.me> <87iko3s3h2.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Mon, 24 Mar 2025 16:59:21 +0100 (CET) Injection-Info: dont-email.me; posting-host="195beb946aec61be46710d1828b12e02"; logging-data="1313037"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19JImnQABsFWEYWkhgZ207A" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cancel-Lock: sha1:tzXQHo5+GbusLgKKctDd6vwILlI= In-Reply-To: <87iko3s3h2.fsf@nosuchdomain.example.com> X-Enigmail-Draft-Status: N1110 Bytes: 3137 On 21.03.2025 00:10, Keith Thompson wrote: > bart <bc@freeuk.com> writes: >> [...] >> Look at this one for example: >> >> typedef uint8_t byte; // from arduino.h >> >> I can only one of reason this exists, which is that 'byte' is a far >> nicer denotation. > > I agree in this case. "byte" documents what the type is intended for. I disagree on both above expressed opinions in more than one way. Byte is a bad term to denote a quantity or an intention. Formerly a "Byte" was used to carry characters; its size could be anything from 5 to 9 bit. There was a reason why in international standards documents there's the 'octet' introduced to unambiguously hint to an 8-bit quantity. Neither is it good, as we see in practice, to assume a 'byte' (whatever it actually is) to be able to carry a character, not even 'char' or 'unsigned char' seem to be able to accomplish that given the "wide character" types in the context of Unicode (16 bit, 32 bit) characters and (variable-length) UTF-8 encodings. Disclaimer: In the early 1990's we supported an include file like the later coming "types.h" where we defined the sized type typedefs and (IIRC) also, for "completeness", typedefs like 'byte'. Actually, and unlike the "sized" types, 'byte' was never used in practice.[*] Janis [*] That's why I'm interested to hear about applications where such a term proved useful (and better suited than 'octet', 'uint8_t', or some sort of 'char'). > [...]