Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site gitpyr.UUCP Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!ihnp4!houxm!whuxlm!akgua!gatech!gitpyr!robert From: robert@gitpyr.UUCP (Robert Viduya) Newsgroups: net.lang.c Subject: Re: runtime 'sizeof()'? Message-ID: <38@gitpyr.UUCP> Date: Sat, 19-Jan-85 22:36:04 EST Article-I.D.: gitpyr.38 Posted: Sat Jan 19 22:36:04 1985 Date-Received: Wed, 23-Jan-85 04:47:18 EST References: <33@gitpyr.UUCP> Distribution: net Organization: Georgia Tech, Atlanta Lines: 43 [] Judging from mail I've recieved about the subject, I think I was a bit unclear about the problem. This should clear things up. The problem is that the sizeof operator produces different answers when used in two different source files. I can declare the following in one source file: ... struct s a[] = { { "....",0,0,0 }, { ",,,,",1,1,1 }, }; ... b = sizeof (a); and have b be set to some number representing the size of a in bytes, but I cannot refer to the same structure from another source file: ... extern struct a[]; ... b = sizeof (a); /* set to zero or a compiler error msg */ The array is defined and initialized to contain data. Therefore, the sizeof operator should work *regardless* of what source file it is used in. robert -- Robert Viduya Office of Computing Services Georgia Institute of Technology, Atlanta GA 30332 Phone: (404) 894-4669 ...!{akgua,allegra,amd,hplabs,ihnp4,masscomp,ut-ngp}!gatech!gitpyr!robert ...!{rlgvax,sb1,uf-cgrl,unmvax,ut-sally}!gatech!gitpyr!robert