Deutsch English Français Italiano |
<v4rfgv$18eq9$5@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Lawrence D'Oliveiro <ldo@nz.invalid> Newsgroups: comp.lang.c Subject: Re: Hex string literals (was Re: C23 thoughts and opinions) Date: Tue, 18 Jun 2024 08:12:15 -0000 (UTC) Organization: A noiseless patient Spider Lines: 24 Message-ID: <v4rfgv$18eq9$5@dont-email.me> References: <v2l828$18v7f$1@dont-email.me> <00297443-2fee-48d4-81a0-9ff6ae6481e4@gmail.com> <v2lji1$1bbcp$1@dont-email.me> <87msoh5uh6.fsf@nosuchdomain.example.com> <f08d2c9f-5c2e-495d-b0bd-3f71bd301432@gmail.com> <v2nbp4$1o9h6$1@dont-email.me> <v2ng4n$1p3o2$1@dont-email.me> <87y18047jk.fsf@nosuchdomain.example.com> <87msoe1xxo.fsf@nosuchdomain.example.com> <v2sh19$2rle2$2@dont-email.me> <87ikz11osy.fsf@nosuchdomain.example.com> <v2v59g$3cr0f$1@dont-email.me> <87plt8yxgn.fsf@nosuchdomain.example.com> <v31rj5$o20$1@dont-email.me> <87cyp6zsen.fsf@nosuchdomain.example.com> <v34gi3$j385$1@dont-email.me> <874jahznzt.fsf@nosuchdomain.example.com> <v36nf9$12bei$1@dont-email.me> <87v82b43h6.fsf@nosuchdomain.example.com> <87iky830v7.fsf_-_@nosuchdomain.example.com> <wwva5jj4zsw.fsf@LkoBDZeT.terraraq.uk> <878qz31096.fsf@nosuchdomain.example.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 18 Jun 2024 10:12:15 +0200 (CEST) Injection-Info: dont-email.me; posting-host="aa8085ada8e9493580a5b327f88f4c87"; logging-data="1325897"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/1TgfqklhR38uQHIwz/E8v" User-Agent: Pan/0.158 (Avdiivka; ) Cancel-Lock: sha1:9E1bUE0OtGJVqDD/uvnPDBNhjyw= Bytes: 2795 On Mon, 17 Jun 2024 18:57:09 -0700, Keith Thompson wrote: > You could use some kind of type punning. For example, this is currently > legal: > > union { > unsigned char buf[4]; > uint32_t n; > } obj = { > .buf = { 0x01, 0x02, 0x03, 0x04 } > }; > > The { 0x01, 0x02, 0x03, 0x04 } could be replaced with 0x"01020304". In Open Source, the definition of “source” is (to the effect of) “the preferred representation of the program for doing development with”. The implication to me is, if the C source form has to be cryptic and error-prone and basically hard to work with, then I would back up one step and use some other form for that part of the source, that would be translated to C source as part of the build process and linked against the rest of the code. The generated C source would not be part of the repo commit history, but the input used to generate it (along with any custom build tool setup/programming) would.