Re:Amazon Ion – A richly-typed, self-describing, hierarchica...
by secondcoming on Saturday November 20, 2021 @08:38AM
(#29287955)
I assume you were using C++? I'm not sure what you describe is possible these days due to UB. At the very least just casting bytes received over the wire to a type is UB, so you technically need a memcpy() and hope that the compiler optimises it out.
[ Parent
| on HN ]
Re:Amazon Ion – A richly-typed, self-describing, hierarchica...
by hliyan on Saturday November 20, 2021 @09:01AM
(#29288122)
Yes, it was C++. I was unfamiliar with the acronym "UB" so did a Google search. Does it mean "Undefined Behavior"? If I remember correctly, primitive types other than strings are memcpy'd. GetStr basically returned a char* to the right place in the buffer.
Re:Amazon Ion – A richly-typed, self-describing, hierarchica...
by secondcoming on Saturday November 20, 2021 @09:46AM
(#29288516)
Apologies, yes Undefined Behaviour
Re:Amazon Ion – A richly-typed, self-describing, hierarchica...
by gpderetta on Sunday November 21, 2021 @05:38PM
(#29300484)
It is not UB if it is correctly aligned.
It is UB if the underlying dynamic type is not compatible from the access type
As the bytes are coming from the kernel, you get to decide the dynamic type.