Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!cmcl2!brl-adm!brl-smoke!gwyn From: gwyn@brl-smoke.ARPA (Doug Gwyn ) Newsgroups: comp.lang.c Subject: Re: structure enhancements Message-ID: <6566@brl-smoke.ARPA> Date: Thu, 15-Oct-87 08:57:37 EDT Article-I.D.: brl-smok.6566 Posted: Thu Oct 15 08:57:37 1987 Date-Received: Sat, 17-Oct-87 07:33:15 EDT References: <112@teletron.UUCP> Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) ) Organization: Ballistic Research Lab (BRL), APG, MD. Lines: 41 In article <112@teletron.UUCP> andrew@teletron.UUCP (Andrew Scott) writes: >1. structure equality/inequality operators This has been brought before X3J11 and rejected. There are several counterarguments of varying force: a. What if the struct contains an array? Equality comparison could be extended to aggregates. b. What if the struct contains a union? The could be made undefined, if we knew how to word it. c. Cannot in general use bytewise block comparison (memcmp): i. padding may contain garbage ii. floating-point representation may not be unique d. Simple-looking operation would lead to lots of code, because in general the comparison would be done member-by-member. e. Facility of limited utility; for instance, a struct member is often a pointer to a string, and strcmp() should be done on those members, but that is not something the compiler is able to determine. f. Doesn't help in comparison of "cookies" such as returned by fgetpos(), because there's no guarantee that distinct cookie encodings will always represent distinct values. Such usages should be done via explicit cookiecmp() functions. >2. appropriate bitfield sizing X3J11 discussed a similar request and decided against it. I don't have a record of the reason, but I suspect not a strong enough case was made for adding this to justify the increased implementation cost. >It's difficult to use bitfields structures to define "templates" for real world >data formats as they now stand. It's difficult in any case! For example, how to you handle 8-bit byte oriented data received on a 9-bit byte system? Bit-fields have limited utility; they were never intended to be a universal solution to the problem of externally-imposed data formats. P.S. This is not an official X3J11 response. If you want X3J11 to pay attention to your ideas, send them to the committee; posting them to this newsgroup does not guarantee they'll receive a fair hearing.