flat assembler
Message board for the users of flat assembler.

Index > Compiler Internals > Structure redefinition

Author
Thread Post new topic Reply to topic
BiDark



Joined: 22 Jun 2003
Posts: 109
Location: .th
BiDark 02 Dec 2003, 03:06
Code:
struc name
{
    .a  dd ?
    .b  dd ?
    .c  dd ?
}

struc name
{
    .a dd ?
    .b dd ?
}

struct name

mov   eax,[struct.c]
    


Could it be more restricted, I can't get access to .c member.
Why doesn it allowed, Tomasz?
Post 02 Dec 2003, 03:06
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 02 Dec 2003, 09:10
Why do you think it should be allowed? You have redefined it, and there is no .c in the new version of your structure.
Post 02 Dec 2003, 09:10
View user's profile Send private message Visit poster's website Reply with quote
BiDark



Joined: 22 Jun 2003
Posts: 109
Location: .th
BiDark 02 Dec 2003, 09:41
I mean, I don't know about how redefinition works, In Masm it does error (when define with difference member set). so Masm is more restricted.

Would be nice if Fasm is restricting doing this (becuase of each include files may have the same name with difference set of members and user don't know)

Oh my eng.
Post 02 Dec 2003, 09:41
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8356
Location: Kraków, Poland
Tomasz Grysztar 02 Dec 2003, 11:32
Many of fasm's macro tricks are based on the feature of redefinition, which is allowed for all kinds of macros (so struct macros too) and symbolic constants. So such restriction would just bring down all the power of fasm's macro system.
But, on the other hand, you can also utilize that power to achieve what you need - you can define macros for structure definitions (like the ones I have posted here some time ago) and build such restriction into them.
Post 02 Dec 2003, 11:32
View user's profile Send private message Visit poster's website 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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.