TGViewer
Блог* Блог* @dereference_pointer_there · 1.98K subscribers
Post #10946 1.1K
#prog #article

ntoh*/hton* is a bad API

But my point is not to bash C.

My point is that this API quirk fundamentally changes how people think about endianness, making them commit mistakes they wouldn’t make otherwise. Many people think integers have an intrinsic endianness, or prefer textual formats to seemingly avoid dealing with endianness, and I have held all these convictions myself at some point.

It’s not that people are stupid. It’s borderline impossible to make the same mistakes if you treat endianness as a parameter of a serialization format. But C doesn’t want you to think about it this way, and so you never realize you were lied to until you get a reason to think hard about it.
  • 🔥 7
  • 👍 5
  • 👏 1
  • 🤡 1
More from @dereference_pointer_there
  1. Oct 6, 2026Post #11556
  2. Oct 5, 2026photo post
  3. Oct 5, 2026https://ayles.github.io/doom-in-kernel/ Коллеги (на этот раз действительно коллеги!) подог…
  4. Oct 5, 2026#cpp
  5. Oct 4, 2026#math #meme
  6. Oct 3, 2026Re: I spent $220 on Google app ads and 60% of the installs were robots My favorite story:…
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook →Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 →