From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,60dd4fe7723c0ef X-Google-Attributes: gid103376,public From: Robert Dewar Subject: Re: Ada Core Technologies announces GNATCOM Date: 2000/04/13 Message-ID: <8d545k$io$1@nnrp1.deja.com>#1/1 X-Deja-AN: 610767561 References: <8coc5e$do2$1@nnrp1.deja.com> <8d0ru2$arc$1@nnrp1.deja.com> <8d1paa$n0n4@ftp.kvaerner.com> <8d2d8j$1tk$1@nnrp1.deja.com> <38f52ea8.0@news.pacifier.com> X-Http-Proxy: 1.0 x31.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Thu Apr 13 18:37:42 2000 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.61 [en] (OS/2; I) Date: 2000-04-13T00:00:00+00:00 List-Id: In article <38f52ea8.0@news.pacifier.com>, "DuckE" wrote: > To quote K&R section 6.2: > "There are a number of restrictions on C structures. The essential rules > are that the only operations that you can perform on a structure are take > its address with &, and accesss one of its members. This implies that > structures may not be assigned or copied as a unit, and that they can not be > passed to or returned from functions. (These restrictions will be removed > in forthcoming versions.)" Well yes, of course in the original K&R C you could not pass struct parameters at all, so the issue does not arise. > As I recall a number of 'C' compilers considered a structure to be more like > an array than like a single variable, so structures were implicitly passed > by reference (in the same manner as arrays still are). I never used a C compiler this broken, although there may have been some. It is fundamental to the C model of parameter passing that a called function can modify the parameter without affecting the caller. Again I wonder if you are remembering typical C code in which structs are passed by pointer. It is really QUITE unusual to see C code where structs are passed by value. There were several C compilers prior to ANSI that did implement this extension, and implemented it correctly (gcc was one such compiler, most certainly no version of gcc has had this serious bug!) > > BTW: I vote for the Import(Ansi_C,...) which should solve the problem more > easily in new code. > > SteveD > > Sent via Deja.com http://www.deja.com/ Before you buy.