#165 Document: creating local label outside its associated label

open
nobody
None
5
2010-01-17
2010-01-17
C. Masloch
No

I have found it useful to define local labels at positions where they'd get assigned to a different non-local label usually. This already works in all current NASM versions, both with actual labels and with equ. Here is an example of this:

function.loop:
; do something
function:
; test something
jnz .loop
retn

I'd prefer this to be a documented feature so I can reliably rely on it.

Discussion

  • nasm64developer

    nasm64developer - 2010-01-19
     
  • nasm64developer

    nasm64developer - 2010-01-19
     
  • nasm64developer

    nasm64developer - 2010-01-19

    Under the hood, the "function.loop" label becomes a plain
    non-local label, rather than one that is local to "function" --
    your code works because the lookup for ".loop" notices the
    leading ".", and thus looks for "function.loop" -- local or not.

    The manual already says in section 3.9:

    "the first definition of .loop above is really defining a
    symbol called label1.loop, and the second defines a
    symbol called label2.loop"

    It could be updated to be more specific.

    Attached find an abbreviated sample which illustrates what
    labels get defined under the hood.

     
  • C. Masloch

    C. Masloch - 2010-01-19

    Okay, so actually a non-local label with a dot can be refered to as if it was a local label. (With the effect that labels local to this label can still be created.) As you said, this could be explicitly explained in section 3.9.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks