What Does This Mean?

Do you know what this means?

htons

No Cheating via Google! Click for the answer …

The answer is “Host To Network Short.” It’s a function from the Berkeley sockets API. It’s needed because different computers use different methods for storing information, and htons converts a number from whatever format that machine uses, to the ‘network short’ format.

This is a perfect example of terrible software engineering.  Maybe I’m totally out of line to criticize something created by people who are far more educated than I am, but how can writing cryptically short function names that give the reader absolutely no clue what they do be considered good engineering? What excuse could you possibly have? That you want to save time in typing? A reasonable name for the function, like, say, HostToNetworkShort, would take 5 seconds to type, as opposed to htons, which takes 1.  Any programmer who spends the majority of his time typing should probably be fired for posting too much on slashdot.

  • Guest
    Or they just, you know, wanted to write compliant and portable C code... you do know that long identifiers are a modern luxury, right?
  • Mark Neyer
    actually i had no idea. i'm glad you commented, because it makes a hell of a lot more sense.
blog comments powered by Disqus