4 ms·
The Nitty Gritty of “Hello World” on macOS (2014)
- foldr 7y agoI wrote a blog post on a similar topic that goes into a bit more detail in some areas: https://adrummond.net/posts/macho https://adrummond.net/posts/macho There have also been some significant changes since 2014.
- jjcm 7y agoFirst time I've seen that style of visualization for the byte code. Really effective way of breaking it down though, and allows a good way of visually seeing sections of code.
- fake-name 7y agoIt's a pretty well known technique. BinViz.io[1] is a online viewer that lets you view arbitrary binaries, Veles[2] is a stand alone viewer. They're super neat for first-pass "is this structured or random data" analysis of binary files. 1: https://binvis.io/ https://binvis.io/ 2: https://codisec.com/veles/ https://codisec.com/veles/
- kuharich 7y agoPrior discussion: https://news.ycombinator.com/item?id=8576901 https://news.ycombinator.com/item?id=8576901
- radiospiel 7y agoShouldn't this be fwrite("Hello, world!\n", 1, 14, stdout) instead? After all, the string is 14 characters in length, not including the terminating NUL char. What does writing a NUL char to stdout do, anyways?
- AlEinstein 7y agoYou are correct! To answer your question, writing a NUL char to stdout is no problem. Some utilities can actually use it as a delimiter since it’s so uncommon. I think most shells would just print nothing on the screen.
- joesavage 7y agoOops, quite right. I’ll try and push up a correction later today. Thanks!