Hacker News new | ask | show | jobs
by 1_player 4589 days ago
Very nice, too bad there are a few typos. For example, the "write" function arguments are not ordered correctly and it's using the wrong line terminator. It should be:

    write(STDOUT, "Hello World!\n", len("Hello World!\n"));
2 comments

Uh, if that's supposed to be C, then there's no STDOUT and the way to compute the length of a string is with strlen(), not len(). It should be STDOUT_FILENO as pointed out below.
thx, will fix it. any other typo ?
In code example, the hexdump starts with B9 90 00 00 08, but in the disassembly is listed as 80 00 00 90. I don't think endianness can change 08 to 80.
not even German endianness ? ;)

thanks for pointing this out.

there is no such predefined thing as STDOUT.

you are probably thinking of STDOUT_FILENO. can you just put "1" there?

also, reordering the "mov"s (so they appear in actual call order: edx, ecx, ebx) will simplify the diagram somewhat.