forked from jmckaskill/c-capnproto
-
Notifications
You must be signed in to change notification settings - Fork 42
Open
Description
I somehow can't leave it uninitialized, or I get,
*** ERROR DECODING PREVIOUS MESSAGE ***
The following error occurred while decoding the message above.
This probably means the input data is invalid/corrupted.
Exception description: expected boundsCheck(segment, ptr, ref->structRef.wordSize()); Message contained out-of-bounds struct pointer.
Code location: capnp/layout.c++:2159
*** END ERROR ***
From the capnp FAQ:
Pointer fields are a bit different. They start out “null”, and you can check for nullness using the hasFoo() accessor. You could use a null pointer to mean “not present”. Note, though, that calling getFoo() on a null pointer returns the default value, which is indistinguishable from a legitimate value, so checking hasFoo() is in fact the only way to detect nullness.
What do I need to do to not set a pointer?
Specifically, I sometimes do not set the worker field here: https://gitlab.com/dxpb/dxpb/blob/1b8775bd089ca3c2df1c53030ddb5adec7fa4313/src/log.capnp#L45-48
Metadata
Metadata
Assignees
Labels
No labels