Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

esoteric observation about if vs iff ... Not a bug, but a curiosity.

Jul
534
10
If you compare string values with ne/eq instead of !=/== as part of an iff, TCC "forgets" that it’s in an iff, and give an error when it hits the endiff.

Which is informative in that it tells me something is clearly wrong. So I found my error. Using eq instead of ==

But still, I found it curious that the same thing in "if" doesn’t give any kind of error.

I’m going to venture a guess: This is because if copies CMD.exe behavior, but iff is it’s own TCC-specific thing?

Discovered via playing around to try to troubleshoot a separate issue...

Code:
@Echo OFF
 
echo %%*  is %*
echo %%1$ is %1$
echo %%1  is %1
 

iff "%1" == "" then
        echo iff eq says it **IS** empty
endiff
iff "%1" == "" then
        echo iff ne says it is NOT empty
endiff

rem No errors yet!

if  "%1" eq "" (echo if  eq says it **IS** empty)
if  "%1" ne "" (echo if  ne says it is NOT empty)

rem Still no errors!

rem but NOW there will be errors:

iff "%1" eq "" then
        echo iff eq says it **IS** empty
endiff
iff "%1" ne "" then
        echo iff ne says it is NOT empty
endiff

 
echo END
 
No errors here (your BTM, exactly).

Code:
v:\> ifftest.btm
%*  is
%1$ is
%1  is
iff eq says it **IS** empty
iff ne says it is NOT empty
if  eq says it **IS** empty
iff eq says it **IS** empty
END

v:\> ifftest.btm x
%*  is x
%1$ is x
%1  is x
if  ne says it is NOT empty
iff ne says it is NOT empty
END
 

My bad!!!

I forgot to mention it only gives an error if %1 is a filename that has "=" in it.

But the actual error is "endiff" being an unknown command.



I just started a new thread that addresses a similar issue
 
Back
Top