Are the following initializations supposed to be different? #4096
Answered
by
gregmarr
LinZhihao-723
asked this question in
Q&A
-
I'm initializing a json object using the following two different alternatives in c++17:
They are initialized with the same data; however, A differs from B. |
Beta Was this translation helpful? Give feedback.
Answered by
gregmarr
Aug 28, 2023
Replies: 1 comment 2 replies
-
Supposed to be, not really, but they are. Unfortunately, it can't easily be fixed. In fact, the behavior varies depending on the compiler, so avoiding B is recommended. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Yes, A is the proper form. You can even simplify it a bit: