Path: utzoo!mnetor!uunet!husc6!mit-eddie!uw-beaver!ssc-vax!cxsea!blm From: blm@cxsea.UUCP (Brian Matthews) Newsgroups: comp.lang.c Subject: Re: A bad design decision early on in ANSI C. Message-ID: <2313@cxsea.UUCP> Date: 2 Jan 88 17:43:02 GMT References: <1322@sugar.UUCP> <1942@ho95e.ATT.COM> Reply-To: blm@cxsea.UUCP (Brian Matthews) Organization: Computer X Inc. Lines: 31 46323-Bill.Stewart,2G218,x0705, (wcs@ho95e.UUCP) writes: |In article <1322@sugar.UUCP> peter@sugar.UUCP (Peter da Silva) writes: |>I would like to suggest removing a "feature" from 'C'. |>Structure assignment/passing. | Structure assignment/passing is part of the 1980 (1979?) extensions to | the C language, which also included enum and void. While | they're newer than K&R, and some early PC C compilers don't | include them, they're an established part of the language, and | infinite numbers of programs would brreak if they went away. | The dp ANSI standard is correct in keeping them. Agreed completely. |3) They don't really add anything. | But they do - they add data hiding. A library can provide | types such as time_t and addr_t for data that is generated by | some library routines and used by others, and *you* don't have | to know what the type is. This can happen whether or not structure assignment is available. You just have to pass pointers (perhaps to a copy) instead of the item itself, expect pointers to be returned (or pass a pointer to an item to be filled in), and use memcpy or bcopy to make copies of the item. Structure assignment adds to the "cleanness" of the language (you can pass and assign any scalar data type), makes copying structures slightly more efficient timewise (inline copy instead of function call. Of course this will increase the size the code), but doesn't add any data hiding capabilities that weren't already there. -- Brian L. Matthews "A power tool is not a toy. ...{mnetor,uw-beaver!ssc-vax}!cxsea!blm Unix is a power tool." +1 206 251 6811 Computer X Inc. - a division of Motorola New Enterprises