2 ms·
What are you doing with json.h:121 in _json_value::&operator[](const char* index) when your key doesn't exist? Still, very nice. Comparable to jsonxx which i'v
by mappu 15y ago
What are you doing with json.h:121 in _json_value::&operator[](const char* index) when your key doesn't exist?
Still, very nice. Comparable to jsonxx which i've been using up until now.
- udp 15y agoHmm, what should I do? (since it returns a reference). I could make it a pointer instead, but then you wouldn't be able to chain it. Maybe some kind of const json_null value to return when the key isn't found. edit: Done that.
- mahmud 15y agolongjmp to an earlier stage where you can "retract" the error or somehow wrap it in a chainable form (e.g. add a union to your result to signal whether it's a value or error, or whatever) That's what exceptions are supposed to do. C doesn't have exceptions, so you use setjmp/longjmp.