flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
iic2 18 Aug 2008, 07:17
....
http://www.codeproject.com/KB/cpp/Macros_vs_Inlines.aspx Quote: Function-like macros when used always expand at the point of usage. The function-like macros are pre-processed at compile time, and as a result, there is really no macro existing at runtime. This is why there is an increase in the size of the binary files. Function-like macros and any other type: The only reason I don't like to use marcos is I thought it will expand your code size at assembler time. But that don't seem to be the case. If a macro is called 10 times to build your windows and furctions and don't add nothing extra, I have no problem with that. but is there more it than that... would 10 expand to 1x,2x 3x,20x, 40x at comply time or is it like un-initialized data which only expand at runtime and use more memory? If so, I can live with that. As long as it don't increase the size of the the final file at comply time by much other than the amount expected () I might as well use them. By saying **expand at the point of usage** This is a difference. Do they mean for each call to a marco do this mean merory continue to grow with each call? Do 100 calls mean 100 extra copies. If so, can we clean up that extra memory and use it for something else. ![]() Anyway, If this is right I can live with that because it's only memory and memory is getting bigger and cheaper these days. Quote: Consider the example below which depicts the disadvantage of the lack of type checking. In this example, the result is always the value passed in as the second argument. I care less of type checking because I'll spend forever on a block of code until I manually check ALL conditions and some... Am Im right to think this way... to not have any need for it. If a program had 1000 marcos all well written to be safe and fast I see no reason not to use them, finally. If macros only expand in memory that's a bonus to me. Am I on the right track. The whole world is talking about C++, JAVA etc, I'm talking assembler. It gave me a lot to think about. I want to end my fear of using them. I can get a better understanding from the assembler codes point of view. |
|||
![]() |
|
FrozenKnight 07 Sep 2008, 09:17
The only Macros is use are the struct macros. I actually enjoy inventing the Gun, bullet, foot and trigger along with all the physics to project the bullet.
|
|||
![]() |
|
baldr 07 Sep 2008, 13:58
FrozenKnight,
Macros add some automation for repetitive/tedious tasks. They also combine some simple instructions in macroinstructions, which are, given the proper name and comment, very useful to make sources much more readable. Periodically I review my old programs' sources to inject newly found tricks/concepts, and well chosen macro name as well as comments helps me greatly to understand once again those bithacks I'd developed ![]() For me, Code: crctab CRC32_TABLE_LE 0xEDB88320 |
|||
![]() |
|
madmatt 07 Sep 2008, 16:47
baldr wrote: FrozenKnight, I agree with what you say, Especially with fasmw macro's where you can have a high level feel and organization without the usual high level language bloat. However, It would be good for beginning programmers to refrain from using most macros and program more in the raw. This would allow you to get a good knowledge of the intel instruction set (how different addressing modes works especially), use the mmx/sse1&2&3 instructions, make improvments to the macros themselves, and finally to be able to read crash dump disassemblies. _________________ Gimme a sledge hammer! I'LL FIX IT! |
|||
![]() |
|
baldr 10 Sep 2008, 23:41
madmatt
I agree with you too. It's important to know what each used macroinstruction does, but it's much more important to know how macroinstruction does that. For example, I almost immediately replaced Code: lea edx,[..address] push edx Code: push edx lea edx,[..address] xchg edx,[esp] Nevertheless some macros are of great utility, like library/import sweet twins. Bare core programming is a great effort in discipline and attention to details, so every bit of help counts, especially for novice. |
|||
![]() |
|
madmatt 11 Sep 2008, 11:11
Good Example. That's something I need to do, I need to pactice my preaching and study the macro library and commands much more in-depth. (by the way, this "fix" should probably be in the next update to fasm.
![]() _________________ Gimme a sledge hammer! I'LL FIX IT! |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.