Frank,
I will look into your suggestions and probably play around with a
C++ interface as it will help my understanding of the right thing
to do.
If you want to contribute your interface there will be some normal
Eclipse formalities (hopefully small) around copyright and
licensing, but we can deal with those if and when they arise.
When I started writing MQTT code about 2005 in C/C++ I started
with the intention of using C++ purely, until I found that
template support in the gcc current at the time (3.4 or similar)
plain didn't work. That's when I reverted to using plain ANSI C
for portability, and where my caution comes from.
I'll definitely add the extern "C" to the header, as Roger voted
for that one too. I'll raise a bug with your suggestions in so we
can track the changes and decisions.
Ian
P.S. My mail client wasn't doing what I wanted which is why I
ended up with two copies and another conversation. Either my mail
client or my control of it...
On 16/05/13 18:43, Frank Pagliughi wrote:
Hey Ian,
No problem. Of these, the only one that I would continue to push
for "correctness" (over convenience) is the const specifier for
pointer parameters (item #2), especially for char* parameters.
It is common to use string literals, and the C++ compiler will
prevent you from doing that. Unless you lie to it.
Frank
On 05/16/2013 01:12 PM, Ian Craggs wrote:
Hi Frank,
I'm not averse to any of these proposed changes. But
before making them, I would need to spend time making sure
that they worked and didn't cause any backward
incompatibility with applications, on as many platforms as
I could. One of the key goals in writing the code was
portability, which is one reason why the use of C features
is conservative.
All of these suggestions can be fixed in a C++ specific
interface without potentially compromising the portability
of the C code which is why I suggested starting with that,
because it's less of a risk.
Ian
|