In terms of a message system for a game, or in general, in C++, which of these three is better? An enum feels best but I think it would mean newer classes could not really contribute. Strings seem nice for scripting advantages but I’m worried about the overhead. Integer defines feel a bit Cish.
Thanks
It all depends on what you are trying to do, what kind of data is in the messages (variable vs fixed-length), frequency of messaging, size of messages, etc. For example, I have seen messaging systems that use
structandunionto package low level messages.There is no one right way to do it, at least not without more information.