flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
smiddy
I recommend reading paragraph 2.3.4 Structures here. It doesn't specify unions as such, but it will get you pretty close to what you're after. I requires relearning how they are done with FASM.
|
|||
![]() |
|
arafel
yes, I read it already. Just hopped that there is some way to do this without resorting to macros.
...anyway now after browsing the sources a bit, it looks like there is no built-in support for unions. so macros are unavoidable. ![]() |
|||
![]() |
|
smiddy
I have to assume your inquisition is based on a C paradigm. ASM isn't C, therefore you have to invent what you want. However, I think the second example in that paragraph conveys a union of sorts. Don't consider a macro a bad thing, go with it, explore the possibility as a useful tool in order to meet your needs. C's abstration with unions is just that, an abstraction where you don't know the nuts and bolts employed to get the end result. Here you have the enviable ability to see/know exactly what is happening and understand the mechanics of it.
What is your aversion to macros? |
|||
![]() |
|
arafel
union declaration merely allows one to refer to a location in a simple and efficient way. In this case there is no nuts and bolts to know or not know, really.
unions are no more an abstraction than let's say fasm's virtual or struc directive. In fact you can regard pretty much everything except the actual instruction mnemonics as an abstraction if judging by this assumption. And anyway, sometime abstraction is a good thing (to a certain degree of course). Even in assemblers. I never said I was against macros or considered them as a bad thing. However I do try avoid them when they are not really necessary, and imo in this case they aren't. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.
Website powered by rwasa.