F
forever a loser
Guest
In MASM32, the IFB and IFNB directives test whether the given operand/parameter/argument of some MACRO is blank or not.
In Microsoft Visual C++ 2010 Express, you can #define parametered macro, like in MASM32, but how to test if a given operand/parameter/argument is blank or not?
Whata are the equivalents to IFB and IFNB of MASM32 in Microsoft Visual C++ 2010 Express?
In MASM32, for example, I could:
print MACRO string
IFNB string
invoke puts, TEXT(string)
ELSE
invoke puts, TEXT("blank")
ENDIF
ENDM
where:
TEXT MACRO string
LOCAL new_label
.data
new_label db string,0
.code
EXITM <offset new_label>
ENDM
And in main program do:
print "string"
print
And output will be
string
blank
I want to achieve the exact same goal in Microsoft Visual C++ 2010 Express:
int main()
{
print("string")
print()
return EXIT_SUCCESS;
}
But how do I #define the print macro above the int main()?
Obviously I don't have to #define the TEXT macro in C and CPP files of course, because the Microsoft Visual C and C++ compilers already understand and accept literals strings quotes in function and macro calls.
So I only need to know how to #define the print macro properly and that's it.
Continue reading...
In Microsoft Visual C++ 2010 Express, you can #define parametered macro, like in MASM32, but how to test if a given operand/parameter/argument is blank or not?
Whata are the equivalents to IFB and IFNB of MASM32 in Microsoft Visual C++ 2010 Express?
In MASM32, for example, I could:
print MACRO string
IFNB string
invoke puts, TEXT(string)
ELSE
invoke puts, TEXT("blank")
ENDIF
ENDM
where:
TEXT MACRO string
LOCAL new_label
.data
new_label db string,0
.code
EXITM <offset new_label>
ENDM
And in main program do:
print "string"
And output will be
string
blank
I want to achieve the exact same goal in Microsoft Visual C++ 2010 Express:
int main()
{
print("string")
print()
return EXIT_SUCCESS;
}
But how do I #define the print macro above the int main()?
Obviously I don't have to #define the TEXT macro in C and CPP files of course, because the Microsoft Visual C and C++ compilers already understand and accept literals strings quotes in function and macro calls.
So I only need to know how to #define the print macro properly and that's it.
Continue reading...