Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!rochester!PT!sei!sei.cmu.edu!firth From: firth@sei.cmu.edu (Robert Firth) Newsgroups: comp.lang.c Subject: Re: swaps with arrays Message-ID: <2590@aw.sei.cmu.edu> Date: Tue, 22-Sep-87 13:19:20 EDT Article-I.D.: aw.2590 Posted: Tue Sep 22 13:19:20 1987 Date-Received: Thu, 24-Sep-87 06:02:01 EDT References: <2376@zeus.TEK.COM> <110@umigw.MIAMI.EDU> <1955@sol.ARPA> <2366@mmintl.UUCP> <768@sugar.UUCP> Sender: netnews@sei.cmu.edu Reply-To: firth@bd.sei.cmu.edu.UUCP (PUT YOUR NAME HERE) Organization: Carnegie-Mellon University, SEI, Pgh, Pa Lines: 24 In article <768@sugar.UUCP> peter@sugar.UUCP (Peter da Silva) writes: >> It is true that the semantics of the assignment of arrays is obvious and >> straightforward (I think -- there may be some traps hiding there somewhere). >Snap! The size of an array is not always known to the compiler. > >For example: > >extern char *sys_errlist[]; But neither is the size of an array in Algol-60, Algol-68, Ada, or most other languages that support soem form of array assignment. There would surely be no difficulty is accessing a runtime descriptor that gave the array size? In fact, since in C all declared arrays have a static size, one could simply generate a hidden external name "sys_errlist_size" or whatever, resolved at link time, and use that. No harder than resolving the array name at link time. On a Vax-11, for instance, .GLOBAL sys_errlist_size, sys_errlist MOVC3 #sys_errlist_size, G^sys_errlist, copy_of_sys_errlist would do the job.