Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: A glitch regarding the usual malloc() idiom Date: Wed, 27 Jul 2016 09:21:46 -0700 Organization: None to speak of Lines: 43 Message-ID: References: <57933a73.4812875@news.xs4all.nl> <5793c8e5.2941812@news.xs4all.nl> <87oa5n97rz.fsf@bsb.me.uk> <87wpkar54r.fsf@bsb.me.uk> <87d1m1r99c.fsf@bsb.me.uk> <871t2hqn06.fsf@bsb.me.uk> <87fuqwp5fc.fsf@bsb.me.uk> <8737mvq15m.fsf@bsb.me.uk> <87bn1jf7et.fsf@bsb.me.uk> <731964a8-0f1e-4028-8570-85812226b611@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="19733"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19VifSxLep/8588pbrBLSk2" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:HBEnUE4H6KZPnZGfFVewr6tjkkI= sha1:/oM2svMSuOpKaypRn6wjPpttlos= Xref: csiph.com comp.lang.c:91154 Malcolm McLean writes: > On Wednesday, July 27, 2016 at 4:05:38 PM UTC+1, Ben Bacarisse wrote: >> Malcolm McLean writes: >> >> > ... The standard uses the term "padding bits" for unused bits >> > in an type. >> >> I know what you mean but I wouldn't call them unused because they might >> be very important. They don't contribute to the value, that's all. And padding bits are defined only for integer types. Other types might have bits that don't contribute to an object's value, but the standard doesn't specify any other types' representations in enough details for it to be necessary to talk about padding bits. (The term "padding bytes", as I've discussed, is used for gaps in structures and unions.) > They could be parity bits. Yes. Some combinations of values of padding bits can result in trap representations. > What's not allowed is "longs runs of zero breaking up bits" (some hardware > doesn't like long runs of identical bits, for electronics reasons, you need > a "rising edge" every so often to keep the clock happy). Please cite the text in the standard that disallows "longs runs of zero breaking up bits". While you're at it, please explain what "longs runs of zero breaking up bits" means. > All bits zero has to mean 0, including padding. Yes. And the standard requires all-bits-zero to be a valid representation of 0 for any integer type (that requirement wasn't explicitly added until one of the post-C99 Technical Corrigenda). Setting a floating-point or pointer object to all-bits-zero could result in a trap representation (though it typically doesn't). -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"