loldevs / libOL

Reference implementation for League of Legends spectator dump decoding. Basically abandoned.
MIT License
13 stars 3 forks source link

Exceptions or no Exceptions, thats the question #6

Closed themasch closed 10 years ago

themasch commented 10 years ago

I feel like we need a proper way to deal with situations like this: https://github.com/loldevs/libOL/blob/master/src/libOL/Blocks/Block.cpp#L48

I think everyone know that exit(1) isn't a proper error handling for library code ;) we never ever should terminate the process. I think thats exactly what exceptions are invented for and we should use them. Same goes for asserts.

What do you guys thing? If we want to be able to write bindings for other languages soon we need a way to take care of errors that is not "terminate the process". Some day our library might become part of a webservice and it kind of sucks if your workers die because our parse isn't happy ;)

TL;DR: +1 for exception all over the place

toulouse commented 10 years ago

Exceptions must not leak into C code. As long as that doesn't happen, sure.

The eventual C code should probably populate struct passed in by pointer, and return error codes, or something.

lukegb commented 10 years ago

Since we're writing C++ here, I think exceptions are only sensible.

It is the responsibility of the C wrapper to ensure that there are no leakages - which it might have to do anyway, since we're calling library functions that can throw.

toulouse commented 10 years ago

@lukegb +1

themasch commented 10 years ago

so i'm counting 3:0 for exceptions? Great!

lukegb commented 10 years ago

@satan6 your thoughts?

sathorn6 commented 10 years ago

Yeah, exceptions are good. +1

themasch commented 10 years ago

Discussion closed, core devs decided pro exceptions. pls reopen if you got good reason AGAINST exceptions.