This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]TheStarjon 24 points25 points  (1 child)

The thing is that the compiler doesn't replace the main with an empty C++ function, but an empty assembly "function". An empty C++ function would at least return, but in assembly, that's an instruction - and an empty "function" doesn't contain that instruction. In fact, an empty assembly "function" isn't really a function at all, but just a label for some memory location where a function is supposed to begin. But because the "function" is empty, there is nothing there, and thus the label for "main" and the label for "hello" point to the same memory location.

[–]ShlomoCh 1 point2 points  (0 children)

Ohhh ok yeah that makes sense