Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83; site ccieng6.UUCP Path: utzoo!watmath!clyde!floyd!harpo!seismo!rochester!ritcv!ccieng5!ccieng6!dwr From: dwr@ccieng6.UUCP ( Donald Wallace Rouse II) Newsgroups: net.lang.c Subject: Re: structure and array and string comparisons Message-ID: <146@ccieng6.UUCP> Date: Thu, 29-Mar-84 00:23:23 EST Article-I.D.: ccieng6.146 Posted: Thu Mar 29 00:23:23 1984 Date-Received: Fri, 30-Mar-84 03:18:29 EST References: <253@opus.UUCP> <365@denelcor.UUCP>, <266@opus.UUCP> Organization: Computer Consoles Inc., Rochester, NY Lines: 38 The version of C that I use allows compile-time initialization of the non-union elements of non-automatic structures, as: static struct s { int e1; char e2; union { int e31; double e32; } e3; } x = { 1, 'c' }; If C special-cases initialization in this way, there is no reason it can't special-case comparisons of structures containing unions. I agree that comparisons other than == != are probably not too useful. Don't worry about holes; let the compiler do it. If the compiler can keep track of holes during initialization, there is no reason that it can't keep track of them during comparison and generate appropriate code to skip them. On a slightly related topic, my favorite extension to C would be structure and array constants on the right-hand side of assignment expressions, as: int x () { struct s x; int i [5]; if (expr) x = { 4, 'x' }; else i = { 1, 2, 3, 4, 5 }; } D2