[gambit-list] Is ___CAST(void*, ___BODY(u8v)) the optimal way to resolve u8vector's data in C?

Phillip Suero philsuero at gmail.com
Thu Oct 29 10:51:10 EDT 2020


In C, I like to get the memory address (void*, char*, etc.) of the blob in
a Scheme u8vector. That is a u8vector that is _still_, of course. Also of
course this means a pointer to the first byte in the u8vector.

I see how to do it here
, and there are multiple suggestions in there.

Of all the suggestions, the "void *u8vectorptr =
___CAST(void*,___BODY(u8v));" form is the shortest form.

The default recommended form however uses "___BODY_AS(u8v,___tSUBTYPED)"
instead of ___BODY. Another suggestion uses &___FETCH_U8(___arg1,0), or
instead of 0, ___INT(0).

Can you please explain, is there any material difference or advantage
between these?

Are they equal so all else the same, the shortest form I mentioned is the
preferable one?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20201029/d12b5788/attachment.htm>

More information about the Gambit-list mailing list