[zeromq-dev] Questions about Coding Style
niXman
i.nixman at gmail.com
Sat Feb 11 12:06:03 CET 2012
2012/2/11 john skaller <skaller at users.sourceforge.net>:
>
> On 11/02/2012, at 9:23 PM, niXman wrote:
>
>> In the example above, it is enough to add check on null pointer ( if
>> (optvallen_ && !(optval_)) {} ). This gives to the user more
>> information about the error, instead of the silent crash.
>
> Agreed.
>
>> Regarding the check of pointers of sockets, everything is simple here.
>> I'm actually very surprised that at present check is implemented in
>> this way.
>>
>> Any function fulfilling operations with sockets except zmq_socket(),
>> should check the pointer for its presence presence in ctx_t::sockets.
>> (IMHO)
>> It can seem an unnecessary overhead. But I consider that this overhead
>> will be very scanty.
>
> Well, if you believe that, you should write the rule up in the Style Guide.
> I would add the qualifier: any "public" function. I.e. a member of the
> official 0MQ C bindings.
>
> Then there's something concrete to:
>
> (a) implement
> (b) argue about
>
> I'm neutral at the moment. I can't see the harm in it.
>
> Also, as to performance: the checks using assert() can be turned
> off with -DNDEBUG already. So it may or may not make sense
> to turn other checks on or off the same way, or to re-implement the
> assert()ions so they *can't* be turned off with NDEBUG.
>
> --
> john skaller
> skaller at users.sourceforge.net
>
>
Before writing something, I want to understand the attitude of the
project Administrators to innovations, and their readiness to take
measures for improving libzmq.
Meanwhile, even my simple patch [1] isn't accepted.
[1] https://github.com/zeromq/libzmq/pull/240
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
More information about the zeromq-dev
mailing list