Defined

Just starting out? Need help? Post your questions and find answers here.
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Defined

Post by Josh »

Why does this code not stop at 'CallDebugger', if the last line is uncommented?

Code: Select all

  CompilerIf Defined (xxx, #PB_Constant) = #False
    CallDebugger
  CompilerEndIf
  
 ;Debug #xxx
Testet with:
Pb 5.51
Pb 5.60
sorry for my bad english
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Defined

Post by TI-994A »

Josh wrote:Why does this code not stop at 'CallDebugger', if the last line is uncommented?

Code: Select all

  CompilerIf Defined (xxx, #PB_Constant) = #False
    CallDebugger
  CompilerEndIf
  
 ;Debug #xxx
You'd get a "constant not found" error if the last line is uncommented. :wink:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Defined

Post by Josh »

TI-994A wrote:You'd get a "constant not found" error if the last line is uncommented. :wink:
Wow, thanks for this knowledge. But this still doesn't explain why CompilerIf isn't working in this case.
sorry for my bad english
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Defined

Post by TI-994A »

Josh wrote:...thanks for this knowledge. But this still doesn't explain why CompilerIf isn't working in this case.

Code: Select all

;#xxx not defined
CompilerIf Defined (xxx, #PB_Constant) = #False
  CallDebugger ; called
CompilerEndIf

Code: Select all

#xxx = 1 ; defined
CompilerIf Defined (xxx, #PB_Constant) = #False
  CallDebugger ; not called
CompilerEndIf
And, you're welcome! :wink:
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Defined

Post by Josh »

And what have your two examples to do with my code? Nothing!
sorry for my bad english
Fred
Administrator
Administrator
Posts: 16681
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Defined

Post by Fred »

CallDebugger is a runtime function, if you uncomment the last line, you get a compilation error.
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Defined

Post by Josh »

Sounds logical I wanted to check some compiler options at the beginning of my code like this:

Code: Select all

  CompilerIf Defined (PB_Editor_CreateExecutable, #PB_Constant) = #False
    CallDebugger
  CompilerEndIf
So I have to make some changes

Thxs @Fred
sorry for my bad english
User avatar
Shield
Addict
Addict
Posts: 1021
Joined: Fri Jan 21, 2011 8:25 am
Location: 'stralia!
Contact:

Re: Defined

Post by Shield »

Are you looking for CompilerError "my error"?
Image
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
User avatar
Josh
Addict
Addict
Posts: 1183
Joined: Sat Feb 13, 2010 3:45 pm

Re: Defined

Post by Josh »

Shield wrote:Are you looking for CompilerError "my error"?
My program speaks German :D

Thxs
sorry for my bad english
Post Reply