From the NASM documentation: The colon after a label is also optional.
I guess this means that both pieces of code create a label called msg
.
Code style, readability & consistency come to mind as a reason for using one over the other. But seeing as the semantics are the same, I would imagine that's the only reason.
Given
x: db 0
andx db 0
, it would seem that both create a label calledx
.I would say you would do
mov rax, [msg]
. This is because in NASM, when you create a label, the semicolon at the end is not included in the name but rather is a hint to the assembler that the end of the label's name has been reached.