flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 31 Jan 2017, 03:10
struc is the fasm native version, struct is the fasm high-level macro.
In fasm you can declare struc's anywhere before you use them no matter the current section, it makes no difference. Code: ;declare struc my_struc a,b,c,d { .a dw a .b dw b .c db c .d db d } ;instantiate my_label my_struc 0x3456,0x9876,'X','r' ;access mov ax,[my_label.a] |
|||
![]() |
|
jorido 31 Jan 2017, 06:03
Can "struc" be used interchangeably with "struct" everywhere then?
|
|||
![]() |
|
revolution 31 Jan 2017, 06:08
No. They are different things.
For example: struc uses curly brackets, struct doesn't. struc uses dots, struct doesn't. struc allows embedded instructions, struct doesn't etc. |
|||
![]() |
|
jorido 31 Jan 2017, 08:37
I mean, when I want to is merely define a simple structure with a few fields:
Code: MyStruct: var1 'aaa' var2 ? var3 ? var4 123 can "struc" be used interchangeably with "struct"? |
|||
![]() |
|
revolution 31 Jan 2017, 09:12
No. Both the syntax and the operation are different.
|
|||
![]() |
|
jorido 31 Jan 2017, 13:09
What those differences are? And when should be 1st and when 2nd?
|
|||
![]() |
|
revolution 31 Jan 2017, 13:36
struc defines a new macro with all the normal features of a macro, except that it requires a label first, but otherwise there is no difference. You can make it do almost anything you need. If you have special or unusual requirements then this might be the one you want.
struct is already a macro with a whole lot of extra processing to define things like the size of each element, and it allows union and various other things. But the usage is mostly fixed. You can't make it do special processing for example, but it can already do many things so it might be just what you need for a particular purpose. To decide which one to use it depends upon what you need from it. It would be too complex to try to enumerate all the various situations that could come up. Your question is very broad. If you have a particular use case then please ask about that and we can try to help you. |
|||
![]() |
|
jorido 31 Jan 2017, 14:33
Thanks.
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.