As of today I am not a cpp programmer , I have been programming in python from quite a long time now, I was implementing PMS 2.5 Dust Sensor when i came across belowcode on github.com
I spent time trying to read the code and what I make out of above is that there are 2 data structure defined.
1 is of type enum and Second is of type struct
and then value of each Estate initalized object is set in PmsInit() function. Correct me if I am wrong !
in python the above will definitely not take these many lines.
enum is only an enumeration of different values (usually integer values) which get their own "names" to ensure that only certain values can be used and to make the code easier to read.
In your above example BEGIN1 equals to 0, BEGIN2 to 1, and so on. Whenever you create a variable/parameter of this type, only the values in the list are allowed.
The second is a struct which is a compound of multiple varaibles that can be treated as one new datatype where its individual fields can be accessed via the dot (e.g. state.size) or deref arrow (e.g. pointer2state->size) notation.
You may be right, but comparing C++ with Python is more than just by line count.
Like comparing a surgeons laperoscope to your bathroom tweezers