[zeromq-dev] why do czmq methods take a char* parameter and not const char*?
Pieter Hintjens
ph at imatix.com
Sun Mar 9 00:40:21 CET 2014
On Sat, Mar 8, 2014 at 2:11 PM, Turkey Breast <turkeybreast at yahoo.com> wrote:
> Can you give an example where adding const would break a method for existing users?
You're right. Adding const breaks code downstream, not upstream. As
Lindley says, the problem is when it's applied inconsistently
(annoying casting from const char * to char *).
Adding const for all char * arguments (CZMQ never modifies char *
arguments) would be OK. It's still inconsistent with other pointer
arguments and IMO confusing (what does it mean to pass a "const FILE
*" argument, for instance?) But it'd be fine.
-Pieter
More information about the zeromq-dev
mailing list