20
May 09

A big sorry-in-advance goes out to every C++ developer who is about to update her/his project to the upcoming Neutron/Photon client lib, version 5.7.2 !

We just achieved “const correctness” throughout the whole library, which means that we pretty much had to change the signature of each and every method in the whole Neutron / Photon SDK. Joyful hours of pleasant anticipation lie ahead, while you will be adapting your code, looking forward to more stability, a clearer interface and the fastest Neutron / Photon C++ library ever released!

Here’s two examples of the changes in detail:

Callbacks until now:

buddySetReturn(int returnCode, JString* userName, nByte status,  JString* buddyUserID, JString* buddyLobby, nByte type, JString** errorList, int errorList_length);

Callbacks in 5.7.2:

buddySetReturn(int returnCode, const JString& userName, nByte status, const JString& buddyUserID, const JString& buddyLobby, nByte type, const JString* const errorList,  int errorList_length)=0;

  • Now it’s clear that the Neutron Library is responsible for releasing the JString, and not the caller. Pointers are only passed for arrays, and also declared ‘const’, avoiding crashes caused by double deletion.

Operations until now:

NeutronGame::invite(JString** actors, int actors_len,  boolean reserveSpot, JString textMessage)

Operations in 5.7.2:

NeutronGame::invite(const JString* const actors, int actors_len, boolean reserveSpot,  const JString& textMessage)

  • Now it’s more obvious that the caller is responsible for freeing the “actors” array. Furthermore, pass-by-value arguments were exchanged by references wherever applicable, to save per

Hope you are looking forward to the update.

Comments are closed.