From owner-freebsd-hackers Sat Jun 13 13:12:40 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id NAA01504 for freebsd-hackers-outgoing; Sat, 13 Jun 1998 13:12:40 -0700 (PDT) (envelope-from owner-freebsd-hackers@FreeBSD.ORG) Received: from bone.nectar.com (bone.nectar.com [204.27.67.93]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id NAA01429 for ; Sat, 13 Jun 1998 13:11:51 -0700 (PDT) (envelope-from nectar@bone.nectar.com) Received: from bone.nectar.com (localhost.communique.net [127.0.0.1]) by bone.nectar.com (8.9.0/8.9.0) with ESMTP id PAA20988; Sat, 13 Jun 1998 15:10:48 -0500 (CDT) Message-Id: <199806132010.PAA20988@bone.nectar.com> X-Mailer: exmh version 2.0.2 2/24/98 X-PGP-RSAfprint: 00 F9 E6 A2 C5 4D 0A 76 26 8B 8B 57 73 D0 DE EE X-PGP-RSAkey: http://www.nectar.com/nectar-pgp262.txt From: Jacques Vidrine In-reply-to: References: Subject: Re: linker set defintion (ls_item) To: zhihuizhang cc: hackers Date: Sat, 13 Jun 1998 15:10:48 -0500 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG -----BEGIN PGP SIGNED MESSAGE----- One definition results in the list of void* immediately following the structure, i.e. +------------------+ | int ls_length | +- - - - - - - - - + | void* ls_item[0] |---> +- - - - - - - - - + | void* ls_item[1] |---> +- - - - - - - - - + | etc.... | The other definition results in the list void* being somewhere unknown. +------------------+ | int ls_length | +- - - - - - - - - + +------------------+ | void** ls_item |---> | void* ls_item[0] |---> +------------------+ +- - - - - - - - - + | void* ls_item[1] |---> +- - - - - - - - - + | etc.... | Hope this helps, Jacques Vidrine On 13 June 1998 at 15:56, zhihuizhang wrote: > > I am reading freeBSD source code concerning the linker set which I believe > is a set of *addresses* of similar symbols. The linker set structure is > defined in kernel.h as: > > struct linker_set { > int ls_length; > const void * ls_item[1]; > } > > The value of ls_item should be the address of an array of pointers. Since > the size of this array is not fixed, I wonder why it is not defined as: > > struct linker_set [ > int ls_length; > const void ** ls_item; > } > > This may have something to do with the C compiler. I hope some C expert > can give me a hint. Thanks in advance. > > ------------------------------------------------- > > Zhihui Zhang > > Department of Computer Science > State University of New York at Binghamton > > Web Site: http://cs.binghamton.edu/~zzhang > > ------------------------------------------------- > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-hackers" in the body of the message > -----BEGIN PGP SIGNATURE----- Version: 2.6.2 iQCVAwUBNYLcyDeRhT8JRySpAQFu/wP+MymEvMbjsb4nnxTSPwSMKetKcqMye1BU u2XNGzPxjLdynreye+3h7Ob06UZGa+h0hURBgWd5c1pbVwqyUcQGC+K0B40mPzwh cwSbpFfn/SEjjhZ5Vs8C8W8msy4mkaF1h1zaYtJxRT/2gRDAFpxUJRwYZ0JOxxLe OmaJ3Hc5Lqg= =R3eV -----END PGP SIGNATURE----- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message