0

paho.mqtt.cpp refer to c version, from aspective of MQTT protocol, the two implements have almost same feature.so why use cpp version to wrapper c version? what is the advantage of cpp version than c version in feature、performance..etc? could someone please give me the answer or provide some materials? I am eager to know for the choice of the two library.

1 Answers1

1

The C++ library simply wraps the C lib and attempts to provide all the features offered by it. Which one you should use is entirely dependent on which language you prefer.

The C++ library uses std::string and shared pointers so that you can manipulate data a little easier and not deal with low-level details of memory management. It also uses futures to perform asynchronous operations without needing to do thread synchronization.

But really, it comes down to your personal preference of languages, although even if your application is in C++, you can use either library. You just need to decide if you would rewrite a bunch of the API yourself if you used the C lib.

Frank P
  • 455
  • 3
  • 7