Skip to content

The day byte alignment came back to bite me

njern.co
2 pointsnjern2 comments
On HN

Comments

"Changing the instances of 13 to 16 in the above code fixed the problem"

Not in my book. It made the symptom disappear, but the problem stayed. You don't compute magical constants and put them in your source code if your language has AlignOf, Sizeof and Offsetof.

As you rightly point out, the more correct solution is of course to use unsafe.Sizeof()

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.