jennyyyyy
Re:Care is needed to use C++ std:optional with non-trivial objects
on Friday January 13, 2023 @09:05AM (#34367880)
>But in this case C isn't even any different, so this tangent is irrelevant anyway. If you take a struct by value in C it, drum roll, copies it!
Not quite, in C you know that the most that can happen is a memcpy() call (or some form of inlined byte/word copy) whereas in C++ a copy constructor can do anything - like allocating memory, which might fail and raise an exception.