Path: csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail From: Tim Rentsch Newsgroups: comp.std.c Subject: Re: bit-fields of type unsigned long and unsigned long long Date: Thu, 24 Jun 2021 11:48:29 -0700 Organization: A noiseless patient Spider Lines: 18 Message-ID: <8635t7ayki.fsf@linuxsc.com> References: <86fsx8bh88.fsf@linuxsc.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="5f9785b3afd09fb507884e20b2dfc5bb"; logging-data="30125"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19I8/Pk8yt0UQuDrYeEPoF+A+9lY0C1JWM=" User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux) Cancel-Lock: sha1:cbY5k9jQsKz/HMSZArfIVSCrYcU= sha1:0az/3V+uwltegIvhhaBaB1CrcbE= Xref: csiph.com comp.std.c:6243 Philipp Klaus Krause writes: > Am 23.06.21 um 19:53 schrieb Tim Rentsch: > >> Bit-fields of types signed and unsigned may use widths up to the >> widths of intmax_t and uintmax_t, respectively. > > WG14 usually doesn't like to use the same syntax as C++ but with a > different meaning. > AFAIK, in C++, you can have an int bit-field wider than int (or whatever > else the type is), but the upper bits then are padding bits. The obvious answer is to ask the C++ committee to change their silly rule. And if they don't want to change it, just ignore it; the C++ rule is already incompatible with C, now it will just be incompatible in a different way. The gap between C and C++ has increased to the point where they should be treated as separate and independent languages.