What is @@:?
I have seen this label in a few code examples, but no idea what its purpose is.
If anyone can enlighten me, that would be awesome. 8)
unnamed next label or unnamed previous label.
jump @f means jump forward to next @@:
jump @b means jump back to last @@:
can be used with any jumps conditional or unconditional.
convenient for a quick piece of code.
call @f wouldnt work afaik.
edit= brain cramp :lol:
and addition
Ah ok. Makes sense (sort of :bgrin:)
I'll have a play and see how it works.
Thanks again. You guys are cram packed full of information. 8)
Quote
Thanks again. You guys are cram packed full of information. 8)
I've got my moments.
Quote from: zedd151 on April 12, 2018, 08:30:22 AMcall @f wouldnt work afaik
"afaik" = "I was too lazy to try"
include \masm32\include\masm32rt.inc ; plain Masm32 for the fans of pure assembler
.code
@@: MsgBox 0, "It works!", 0, MB_OK
ret
start: call @B
exit
end start
Quote
"afaik" = "I was too lazy to try"
sticks and stones, jochen.
as a matter of fact I never even considered it until this topic came up today.
Now I learned something new today. Thank you! :icon14:
edit for missing bracket.
Quote from: Lonewolff on April 12, 2018, 08:16:25 AM
What is @@:?
I have seen this label in a few code examples, but no idea what its purpose is.
If anyone can enlighten me, that would be awesome. 8)
They are rather useful when avoing duplicate label, such for instance when expanding macros.
Say it you have some Macro:
foo MACRO
code bla bla
bla
bla bla bla
done:
end m
If you use foo macro twice, you will have a duplicate "done:" label
.code
foo
foo
; you ended up with an error... two labels called "done:"
Quote from: LordAdef on April 12, 2018, 09:35:05 AM
They are rather useful when avoing duplicate label, such for instance when expanding macros.
Thank you, Lord! (Adef that is) --- always wanted to say that --- lol
Thats the part I was missing. Probably the main reason for its existence. (@@:)
The "@@:" notation are actually called anonymous labels and they serve a purpose where repeatedly creating named labels is a pain. The usage has been explained above.
jmp @B ; means jump to the previous @@: label
jmp @F : means jump to the next @@: label.
Quote from: zedd151 on April 12, 2018, 09:07:53 AM
Now I learned something new today. Thank you! :icon14:
Me too, thanks (https://www.urbandictionary.com/define.php?term=sticks%20and%20stones) ;)
Quote from: LordAdef on April 12, 2018, 09:35:05 AMThey are rather useful when avoing duplicate label, such for instance when expanding macros.
Alex, that is very risky. Imagine this scenario:
cmp eax, ecx
je @F
DoSomeStuff
@@:
Now the Million Dollar Question: What happens if there is an anonymous label inside your DoSomeStuff macro?
QuoteNow the Million Dollar Question: What happens if there is an anonymous label inside your DoSomeStuff macro?
Surely a big and ugly mess :dazzled:
I only used the macro as a quick example of label duplication. I wouldn't nest anonimous labels anyway, but thanks for pointing that out, it's indeed a risk