News for hackers. Stuff that matters.
Re:The Nitty Gritty of “Hello World” on macOS (2014) by foldr on Tuesday May 05, 2020 @04:33AM (#23077799)
I wrote a blog post on a similar topic that goes into a bit more detail in some areas: https://adrummond.net/posts/macho There have also been some significant changes since 2014.
Re:The Nitty Gritty of “Hello World” on macOS (2014) by jjcm on Tuesday May 05, 2020 @11:55PM (#23087774)
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.
Re:The Nitty Gritty of “Hello World” on macOS (2014) by fake-name on Wednesday May 06, 2020 @01:04AM (#23088053)
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/ 2: https://codisec.com/veles/

Re:The Nitty Gritty of “Hello World” on macOS (2014) by radiospiel on Wednesday May 06, 2020 @06:07AM (#23089391)
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?
Re:The Nitty Gritty of “Hello World” on macOS (2014) by AlEinstein on Wednesday May 06, 2020 @07:51AM (#23089928)
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.

Re:The Nitty Gritty of “Hello World” on macOS (2014) by joesavage on Wednesday May 06, 2020 @08:02AM (#23089993)
Oops, quite right. I’ll try and push up a correction later today. Thanks!
Re:The Nitty Gritty of “Hello World” on macOS (2014) by kuharich on Wednesday May 06, 2020 @12:32AM (#23087919)