-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about get_ptr() #127
Comments
In fact, if "writing data to the pointee of the result yields an undefined state", why not simply return a pointer to const in all cases, so the compiler will make sure I cannot modify the pointee. |
Sorry, I've read #91 but I still don't get it. |
Sorry about the confusion. It is OK to write to the pointer if you are sure that the underlying JSON object did not change. Once that object changed, the pointer is not valid any more. |
OK, that's much more clear now. Thanks for the clarification.
|
I'll add a comment to the function in a later commit. Thanks for the discussion! |
I see the following in the documentation of get_ptr()
"@warning Writing data to the pointee of the result yields an undefined state."
IIUC this means that the following code yields an undefined state:
i.e. I cannot modify the integer value inside the json
Why is this so?
The text was updated successfully, but these errors were encountered: