Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [paho-dev] Using C++ with the Paho C client library

On 05/17/2013 10:26 AM, Ian Craggs wrote:

1) char* -> const char*
2) char ** -> char* const*  (for reasons as you pointed out:
3) structures to be const (opts*  becomes const opts*)
4) char* elements of structures to be const char*

Then applying the same principles to callback functions.

Yes, that all sounds pretty good to me. Also note the use of the array notation in execv: "char *const argv[]".
That seems understandable enough.

I hadn't thought of item #4 for the structs, but it does make sense.

Here are reasons not to use const definitions instead of #defines in C:

Agreed. This one may cause more trouble in C than it solves. Just be wary of naming conventions, even for "internal" headers that get pulled into an app indirectly. The pre-processor can be so destructive.


Back to the top