It's not the worst tbh. It looks bad out of context, but given how UDP works, you need some value that represents a specific "connection" to the server.
So what does "magic number" do? Does it cast some magic? Or does it identify a UDP Connection? If the latter, why isn't it named "UDPConnectionID" or something similar? Wouldn't that be much more readable?
I think this is a valid question, not sure why it's been downvoted. I can only think that magicnumber would be ok if it's litterally called magic number in whatever protocol is being processed.
Otherwise I completely agree, UDPConnectionID would be loads better.
I know this is an old comment, but that's actually exactly the case here. Apparently, UDP does use the term magic number as part of the protocol. At least that's what I found out from other comments here.
38
u/gu3st12 Jun 09 '20
It's not the worst tbh. It looks bad out of context, but given how UDP works, you need some value that represents a specific "connection" to the server.