c++ - Using constants instead of macros -


is possible replace macros constants, if macro defined macro this:

#define start_offset    0 #define address_offset  (start + start_size) #define size_offset     (address_offset + address_size) , on 

i'm not entirely sure, happen if use global constants , initialize them constants. can considered safe?

the reason using constants possibility wrap them namespace. btw, i'm using macros these working messages stored in byte arrays.

is structure serialization better option?

i'm not entirely sure, happen, if use global constants , initialize them constants. safe?

yes, that's fine.

const int = 4; const int j = 6; const int k = + j; // legal 

is structure serialization better option?

it depends on want accomplish. right now, question broad. there no golden hammers in c++.


Comments