flat assembler
Message board for the users of flat assembler.

Index > Main > eax dd ?

Author
Thread Post new topic Reply to topic
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji
Code:
struct C
eax dd ?
ends

B C
mov eax,[B.eax]

;2 passes  8 bytes
    
this should not be allowed.

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 02 Nov 2010, 15:09
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17715
Location: In your JS exploiting you and your system
revolution
Why not? eax is still eax. The new label "B.eax" is distinct from any register name.

Would you also disallow "random_.eax.ebx.ecx.edx" as a label_name?
Post 02 Nov 2010, 15:13
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji
Code:
eax dd ?  ;alone
    
Inside a "struct" this does compile,
but "alone", this does not compile.
it's illogical

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 02 Nov 2010, 15:18
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17715
Location: In your JS exploiting you and your system
revolution
struct is a macro, so anything is possible within it.

This would not work with struc though, you need to prepend a ".".
Post 02 Nov 2010, 15:21
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

ok, in this case the problem is the following for me:
Which are the words allowed in "struct" (as labels)
who are normally prohibited elsewhere?


edit:
----
That said, I stand by what I said.
Allowed in a struct, not outside ...
this does not give an overall consistency to the compiler
a macro, like struct, should not be allowed that the compiler itself does not!
(sorry for my english)

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 02 Nov 2010, 15:36
View user's profile Send private message Send e-mail Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 17715
Location: In your JS exploiting you and your system
revolution
Why do you want to restrict macros in what they can do? that would reduce the functionality of fasm.
ouadji wrote:
Which are the words allowed in "struct" (as labels)
All are allowed since the labels are built up from the structure name and the member tags. But this only applies if struct is the "normal" macro. If someone is using a custom struct macro then it could be something completely different.
Post 02 Nov 2010, 21:59
View user's profile Send private message Visit poster's website Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji
Quote:
... since the labels are built up from the structure name and the member tags ...
I finally understood "why" and "how",
thank you revolution for this magic sentence.

All words are allowed inside a "struct", ok.
(This is indeed logical if labels name are built up from the structure name)

_________________
I am not young enough to know everything (Oscar Wilde)- Image
Post 02 Nov 2010, 22:16
View user's profile Send private message Send e-mail Reply with quote
bitshifter



Joined: 04 Dec 2007
Posts: 764
Location: Massachusetts, USA
bitshifter
I often use a dot prefix to use reserved keywords as labels...
Code:
...
.ret: ;<-- label
 ret  ;<-- instruction
    
Post 03 Nov 2010, 03:11
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.