Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site harvard.ARPA Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!godot!harvard!stew From: stew@harvard.ARPA (Stew Rubenstein) Newsgroups: net.lang.c Subject: Re: setjmp and typedef'd arrays; thoughts on &array Message-ID: <101@harvard.ARPA> Date: Sun, 21-Oct-84 01:37:46 EDT Article-I.D.: harvard.101 Posted: Sun Oct 21 01:37:46 1984 Date-Received: Mon, 22-Oct-84 01:55:34 EDT References: <22197810.8e4@apollo.uucp> <981@bbncca.ARPA> <524@wjh12.UUCP> <> <394@ncoast.UUCP> <975@CSL-Vax.ARPA> Organization: Aiken Computation Laboratory, Harvard Lines: 37 > > C purportedly handles arrays as if they were blocks of data and pointers. > > However, it doesn't, quite. The declaration > > > > char **foo, bar[10]; > > > > should allow me to say > > > > foo = &bar; > > > > later on.h, since bar should be a pointer to char. Unfortunately, bar > > is what I call a VIRTUAL pointer -- it assembles as a literal (look at > > your compiler's output). To work correctly, it would have to assemble > > to a constant pointer which always points to a particular block of memory, > > in which case the above would work. (Notice that the above is essentially > > the jmp_buf, expanded.) Instead, there is no such thing as &bar because > > bar is not a variable, it is a literal. > > This is not an anomaly, and there is no reason to invent the term "virtual > pointer". In your example, "bar" is a constant of type pointer-to-char. As > a constant, it does not have an address. It is no more legitimate to write > &bar and expect to get the address of a cell containing bar's value, than it > would be to write &1 and expect to get the address of a cell with the value > 1 in it. > > I'm not going to try to respond to the other points in your message or the > other discussion that's been going on in this area just now. > > --Tim Ah, but Vax/VMS VAX-11 C *does* allow &1, meaning the address of a cell with a 1 in it. However, only for the special case of function call argument lists so that you can pass a constant by reference to languages that don't have call-by-value. -- ----------------------- Stew Rubenstein UUCP: ihnp4!harvard!stew Harvard Chemistry ARPA: stew@harvard