-
Notifications
You must be signed in to change notification settings - Fork 15
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
Enum has no buffer #2
Comments
I do not have access to C++ compiler now. I'll test when I get home. Zero is NULL terminator in char array and strings. Possible that your string is terminated by NULL. You should try to compare the enum to the original enum and see if the values are the same. |
the string terminating char shold be '\0', not 0. |
You can run the code below in cpp.sh or other online C++ compiler.
|
There are size differences between '\0' and 0. '\0' is 1 byte zero while literal 0 in source code is usually translated to at least 4 bytes. |
the value of '\0' is 0 so comparing it to 0 will be same ,but I think in case of enum as value 0, should be different. |
But you cast it to const char* |
yes, so that I can serialize it over network. I would expect the enum to be a 0, even if I changed the enum to be of type int, I think same result (I don't have compiler now) |
Hi, I tested with enum with default value 0, the buffer stored is empty. v0.9.9
Repro
The text was updated successfully, but these errors were encountered: