[Openmcl-devel] memory

Alexander Repenning ralex at cs.colorado.edu
Wed Apr 14 10:34:57 PDT 2010

On Apr 14, 2010, at 8:23 AM, Tim Bradshaw wrote:

> On 14 Apr 2010, at 14:58, Alexander Repenning wrote:
>> 2) sizeof as C/C++/Ojective-C inspired sizeof operator returning the number of RAW bytes with no meta information (no headers, no tag bits, ...) typically used to deal with FFIs. Mostly used in the context of allocating raw memory and accessing it with (%get-byte ...) kinds of functions.This is what we need to interface with OpenGL/ Cocoa and other APIs on Macs and PCs.
> How is this useful?  I want SIZEOF to tell me how many instances of an x I can fit in y bytes of memory, not some number which tells me something I can't see a use for.
> For this version of sizeof, what would, say (sizeof (make-instance ...)) be useful for?
> Perhaps your objection is that this thing should not be called sizeof because it's too reminiscent of the C function.

both cases make sense and are useful. 

I think the all inclusive case would deserve a different name - can't come up with a good one - or perhaps some keyword parameter, e.g.

(sizeof 3.14) => 4   ;; CCL32/64 Mac and PC
(sizeof 3.14 :raw-bytes-only nil) => 8 ;; CCL32


Prof. Alexander Repenning

University of Colorado
Computer Science Department
Boulder, CO 80309-430

vCard: http://www.cs.colorado.edu/~ralex/AlexanderRepenning.vcf

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.clozure.com/pipermail/openmcl-devel/attachments/20100414/0648d28f/attachment.htm>

More information about the Openmcl-devel mailing list