[zeromq-dev] Questions about Coding Style

john skaller skaller at users.sourceforge.net
Sat Feb 11 21:05:55 CET 2012


On 12/02/2012, at 3:53 AM, John D. Mitchell wrote:

> Good morning,
> 
> On Feb 11, 2012, at 01:51 , john skaller wrote:
>> On 11/02/2012, at 8:27 PM, niXman wrote:
> [...]
>>> Continuing review of the libzmq code, I have found a few situations
>>> when the program will be crushed on segmentation fault.
>> 
>> It's impossible to avoid this in C.
> 
> That's bollocks.

Let me rephrase: it is impossible for the library writer
to avoid it.

Actually, that is bollocks as you say. It really can be done close to 100%
but you may not like the cost.

> There's certainly a realm of things way out beyond the boundaries that are beyond the reasonable control of a library like 0mq. Taking care to deal with basic, fundamental errors of parameters to functions is NOT one of them.  This is a huge, lazy, cop out

Sorry: some people favour robust programming. 
I'm not one of them. You just have to accept that fragile programming
advocates have a point too. You may not understand it, but that's
no reason to accuse those with a differing view point of being lazy
or coping out.

It's possible for the library to robustly check the pointers.
It doesn't. Why? Because it's expensive. It's a performance
hit. The library makes a cursory check .. and it's really stupid
because it uses a really bad type for sockets (void* is the worst
possible choice). A type based check is free.

--
john skaller
skaller at users.sourceforge.net







More information about the zeromq-dev mailing list