Code:
MACRO bvaz(asciizString) = BYVAL IIF&(lstrlen(asciizString), VARPTR(AsCIIZString), %NULL) LOCAL sz AS ASCIIZ * something CALL FunctionWhichNeedsNullWhenStringIsEmptry (bvaz (sz))
MCM
MACRO bvaz(asciizString) = BYVAL IIF&(lstrlen(asciizString), VARPTR(AsCIIZString), %NULL) LOCAL sz AS ASCIIZ * something CALL FunctionWhichNeedsNullWhenStringIsEmptry (bvaz (sz))
MACRO mZP2S(p) = IIF$(p, @p, "")
sz = mZP2S(p)
#compile exe #dim all #debug error on #debug display on '<===================== see what happens if you comment it out? '-------------------------------------- macro mZP2S(p,sz) macrotemp stemp dim stemp as asciz * 1 stemp = "" if p = 0 then sz = stemp else sz = @p end if end macro '-------------------------------------- function pbmain () as long local i, n as long local p as asciz ptr local sz as asciz * 64 local s as string s = "hello, hello" ? @p '<============= gives an error due to a null pointer mZP2S(p, sz) ? sz '<============= no error - string derived by macro from null ptr is null p = strptr(s) MZP2S(p, sz) ? sz end function
We process personal data about users of our site, through the use of cookies and other technologies, to deliver our services, and to analyze site activity. For additional details, refer to our Privacy Policy.
By clicking "I AGREE" below, you agree to our Privacy Policy and our personal data processing and cookie practices as described therein. You also acknowledge that this forum may be hosted outside your country and you consent to the collection, storage, and processing of your data in the country where this forum is hosted.
Leave a comment: