[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sizeof
- To: Robert Bruce Findler <robby+@CMU.EDU>, info-mcl@cambridge.apple.com
- Subject: Re: sizeof
- From: e@flavors.com (Doug Currie, Flavors Technology, Inc.)
- Date: Mon, 10 Jan 1994 17:37:00 -0500
>> >Is there an equivalent of the C sizeof macro in MCL?
>> I don't think so; what would it do?
>
>It would return the size in bytes of a structure. Earlier I found myself
>making a CTabHandle, by doing something like this:
>
>(make-record :ColorTable :storage :Handle
> :length (+ (sizeof :ColorTable)
> (* num-colors (sizeof :ColorSpec))))
Mark Tapia is correct in his earlier reply that record-length is the LISP
equivalent of c sizeof in this case (I thought you were looking for the
size of a LISP heap rather than a Mac heap object). I write to caution you
that record-length is a LISP macro, not a function, so be sure to recompile
the file containing your make-record if the included records (:ColorTable
or :ColorSpec in this example) change in size. This is not much of a
problem in your example since the records are MacOS defined and are
unlikely to change. It's more likely to bite you if you define your own
record types.
e