flat assembler
Message board for the users of flat assembler.
Index
> Main > a small idea for FASM |
Author |
|
decard 01 Oct 2004, 06:51
Maybe this would make anonymous albels a bit more powerful, but think about code readability... I think that @f and @b is just enough.
|
|||
01 Oct 2004, 06:51 |
|
Matrix 01 Oct 2004, 10:39
You should write programs instead of thinking about this.
jmp [offset] is far enough for programming and additionally you directly tell your machine to jump to that code. if you have an idea like that, you must been thinking of this: jmp global.randomlabel or jmp runtime.randomlabel jmp label1 label2 label3 [bx] - do we need this function too? where global.randomlabel is generated at compile time and jumps to a random label. Where runtime.randomlabel is using a table or making a randomize while your code is rrunning and jumps there. but currently the only purpose of these functions' might be making a random thing to happen like after someone entered a wrong code in an internal use program you know MATRIX |
|||
01 Oct 2004, 10:39 |
|
vbVeryBeginner 01 Oct 2004, 11:06
decard wrote:
i did think about the issue of code readability, imho, i guess the use of jmp @@fff usually function as short jmp, (could be easily trace within 40 lines of code, about a screen page in 800x600) fasm manual wrote:
i guess, the purpose of label is there to help us to get the address. to jmp easily to somewhere |
|||
01 Oct 2004, 11:06 |
|
S.T.A.S. 01 Oct 2004, 11:42
Aren't (already allowed) labels like .1 .2 .3 .... enough?
|
|||
01 Oct 2004, 11:42 |
|
crc 01 Oct 2004, 12:14
Quote: Aren't (already allowed) labels like .1 .2 .3 .... enough? When did FASM start supporting lables with names like .1? Last time I tried to use them (a couple versions back), they weren't allowed. |
|||
01 Oct 2004, 12:14 |
|
pelaillo 01 Oct 2004, 13:14
<imho>
The use of @nnonimous labels is a false timesaving feature. You save some seconds while writing them the first time because you don't need to think in a meaningful name. But you will pay it each time you access further to the source in readability and in terms of fatigue (your mind needs to process the search). But there is also a problem of reusability of the code i.e. if you cut'n paste from one place to another, you will have to revise upstream and downstream to avoid nasty bugs. Lesser risk if you have used meaningful labels. The use of meaningful labels avoids also boring overcommented sources. </imho> |
|||
01 Oct 2004, 13:14 |
|
decard 01 Oct 2004, 13:23
IMO there are cases when anonymous labels are quite natural. See following code:
Code: invoke IsDlgButtonChecked, [.hwnd],fdlgSearchInRadioID ; search in current source file? or eax,eax jz @f jmp .range_ok @@: inc ebx invoke IsDlgButtonChecked, [.hwnd],fdlgSearchInRadioID+1 ; search in whole current file? or eax,eax jz @f jmp .range_ok @@: inc ebx invoke IsDlgButtonChecked, [.hwnd],fdlgSearchInRadioID+2 ; search in all opened files? or eax,eax jz @f jmp .range_ok @@: inc ebx it checks state of some checkboxes and sets some flags according to them. In this case anonymous labels are a natural choice, and they don't break the readability, as that distance between "@@" and "@f" is really short. |
|||
01 Oct 2004, 13:23 |
|
vbVeryBeginner 01 Oct 2004, 13:40
Quote:
i agree with you, pelaillo Code: jmp @ff jmp @f3 i did understand this idea does has some drawback, coz we might need to modify all the jmp @f or @b when we add a new @@: between them. i am thinking how we could solve this issue until then, maybe, decard wrote:
holds true sincerely, vbVeryBeginner |
|||
01 Oct 2004, 13:40 |
|
S.T.A.S. 01 Oct 2004, 14:07
crc wrote: Last time I tried to use them (a couple versions back), they weren't allowed. But later this was considered as a bug, and now it's just normal local label, starting with dot (thank to vid for pointing to this). _______________ IMHO all these L2, ND, STRT and other weird names comes from ancient times when computers had very small amount of memory (say 32K or less) for a source file.. Of cource, @@ is useful sometimes, so it survived, but long names may work better than comments. |
|||
01 Oct 2004, 14:07 |
|
vid 04 Oct 2004, 10:28
i would like allowing access to second anonymous label forward / backward.
you may use them at small if-else and loop constructs: Code: cmp eax,0 jz @f call EAX_z jmp @ff @@: call EAX_nz @@: or Code: cmp ecx,0 jz @ff ;skip loop @@: ... dec ecx jnz @b @@: etc. Assembly code is unreadable anyway, if it isn't written readable. If it is, then things like that one is more readable than with another label i think. And if someone wants to use @fffff then he wouldnt write rest of code readble anyway. |
|||
04 Oct 2004, 10:28 |
|
pelaillo 04 Oct 2004, 13:28
But writing unreadable code shouldn't be encouraged in any way
|
|||
04 Oct 2004, 13:28 |
|
roticv 04 Oct 2004, 14:17
It was already encouraged by @F and @B. I think it is a good feature to add.
|
|||
04 Oct 2004, 14:17 |
|
vbVeryBeginner 04 Oct 2004, 15:25
vid wrote:
|
|||
04 Oct 2004, 15:25 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.