flat assembler
Message board for the users of flat assembler.
Index
> Main > How do you know if a macro as being defined? |
Author |
|
decard 29 Jun 2005, 04:28
See fasm faq.
|
|||
29 Jun 2005, 04:28 |
|
xanatose 29 Jun 2005, 18:33
Thank you,
So basically equ is declared in the preprocessor stage, while = is done at the assembler stage. Thats why this did not work [code] MyHeader_Internal = 1 if defined MyHeader_Internal ; Private else ;public end if [/b] But this do [code] MyHeader_Internal equ 1 if defined MyHeader_Internal ; Private else ; public end if [/b] Two suggestions: 1. Include the FAQ inside the zip distribution. 2. Make the keywords bold in the pdf documentation so they could not be easily skipped. After some searching I did find defined in the manual (near the explanation for used with no examples. |
|||
29 Jun 2005, 18:33 |
|
vid 29 Jun 2005, 20:53
you got it wrong. First one DOES work, but i quess you didn't realize that "if" is handled at assembly time, so preprocessor code will be taken from both parts.
Code: if 1 a equ 1 b = 1 else c equ 1 d = 1 end if Here both "a" and "c" will be defined, because "equ"s (and all preprocessor stuff) is handled before handling "if". FASM's "if" is something else than C's #if, C's one is preprocess-time, while in assembly it is handled later. By the way, second code works in other manner than you thought, with "MyHeader_Internal equ 1" code is preprocessed to Code: if defined 1 ;Private else ;public end if If it isn't defined then assembled code is Code: if defined MyHeader_Internal ;Private else ;public end if so it checks for constant named "MyHeader_Internal" (for example label), and suposing you haven't any label/constant of such name, condition is false. Also [url=http://decard.net/?body=tajga&chapter=preproc my preprocessor tutorial[/url] might clear it for you. |
|||
29 Jun 2005, 20:53 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.