Some suggestions for naming protobuf protocol variables

Created at 15 Feb 2020, 06:32
How’s your experience with the cTrader Platform?
Your feedback is crucial to cTrader's development. Please take a few seconds to share your opinion and help us improve your trading experience. Thanks!
15

158197794

Joined 26.07.2019

Some suggestions for naming protobuf protocol variables
15 Feb 2020, 06:32


When compiling the files generated by the protobuf tool in C ++, there were some errors here. The reason is that the variables are named and
Some variable naming conflicts in the system header file windef.h. Because they are all in the global namespace. E.g:
Windef.h has the following definitions:
typedef struct tagPOINTS
{
#ifndef _MAC
    SHORT x;
    SHORT y;
#else
    SHORT y;
    SHORT x;
#endif
} POINTS, * PPOINTS, * LPPOINTS;

OpenApiModelMessages.pb.h has the same variable names:
enum ProtoOASwapCalculationType: int {
  POINTS = 0,
  INTEREST = 1
};

The POINTS here are conflicting, and errors will occur during compilation.


Similarly
enum ProtoOADealStatus: int {
  FILLED = 2,
  PARTIALLY_FILLED = 3,
  REJECTED = 4,
  INTERNALLY_REJECTED = 5,
  ERROR = 6,
  MISSED = 7
};

The ERROR and MISSED inside are also global named variables that have appeared in some header files included in the system.


So, can you change the name in the description file defining these protobuf protocols? Or, can you add a namespace when you define it instead of putting it in the global namespace?


@158197794