
The Nitty Gritty of “Hello World” on macOS (2014) - luu
http://www.reinterpretcast.com/hello-world-mach-o
======
foldr
I 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
First 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
It'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/)

------
radiospiel
Shouldn'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
You 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.

------
kuharich
Prior discussion:
[https://news.ycombinator.com/item?id=8576901](https://news.ycombinator.com/item?id=8576901)

