[zeromq-dev] Questions about Coding Style

niXman i.nixman at gmail.com
Sat Feb 11 10:27:57 CET 2012

Hello list.

Continuing review of the libzmq code, I have found a few situations
when the program will be crushed on segmentation fault. On the one
hand, it is possible to refer to an error because of the user. But on
the other hand, Coding Style says: Assertions say that the ØMQ
developers do not expect this situation to ever happen, i.e. it is an
internal error that demands a fix to the ØMQ code.

I consider that programs crash on segmentation fault is an
inadmissible error of the ØMQ developers', but not the library user's.

For example the call:
>rc = zmq_setsockopt (sub, ZMQ_SUBSCRIBE, 0, 4);
will end on segmentation fault on line 56 of the sub.cpp file.

According to the documentation, if an error occurs, the function
should return -1.

I can not decide how to handle such a situation. Should I use assert
or return EINVAL?


More information about the zeromq-dev mailing list