On Sun, 2021-10-24 at 17:53 -0700, jlfo...@berkeley.edu wrote:
> But this seems overly complicated.

Sorry. That was a joke. You asked why you can't use len(); you can, by
using it to it into create something that is indexable (and so a
possible parameter for len()).

> Plus, I don't see why this is unsafe. Please advise.

To get the size of a struct in bytes, you use the unsafe.Sizeof
operator (which is a compile time constant). This
https://github.com/golang/go/issues/5602 may help with knowing why that
is in unsafe.




-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/86108b19bea4fb644e89b7a15804e240c6153cfe.camel%40kortschak.io.

Reply via email to