[nanomsg] Re: assertions in cpp binding

  • From: Martin Sustrik <sustrik@xxxxxxxxxx>
  • To: nanomsg@xxxxxxxxxxxxx
  • Date: Fri, 04 Oct 2013 20:27:31 +0200

Hi Immanuel,

I'm exploring if I can exchange the backend of our system to nanomsg
and started to create a Qt binding on top of the cppbinding. (If I
have time, I will make that available to the public...)
However the assertions, which are thrown whenever an error occurs, are
a little bit annoying.

You mean exceptions rather than assertions, right?

I mean the errors are being handled and reported to errno, so why
assert there? Could we get rid of them and add functionality to the
socket class, to check for the error which occurred and let the
functions just return -1. So that the user of the api can implement
her/his preferred error handling?

Exception are standard C++ mechanism for reporting errors. Why not use raw C API in case you want errnos instead of exceptions?

Martin

Other related posts: