Hacker News new | ask | show | jobs
by efitz 72 days ago
When my data structures are messages to be sent over a network, I always start with msgId and msgLen, both fixed width fields.

This solves the message differentiation problem explicitly, makes security and memory management easier, and reduces routing to:

switch(msg.msgId): …

1 comments

switch on version, then messageId…