Shop OBEX P1 Docs P2 Docs Learn Events
Global Constant — Parallax Forums

Global Constant

Don PomplunDon Pomplun Posts: 116
edited 2011-11-22 11:33 in Propeller 1
I want to define a DIAG constant that will be global to all objects in the project. The Scope Of Constants paragraph (p.199) discusses the Num#DEC syntax, but that seems to go in the wrong direction, hierarchically. i.e., it lets higher objects reference use constants in lower objects. I think what I want is to define a constant in the Top Object that all others can test to then perform the diagnostic steps.
Ant help?
TIA
Don

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2011-11-22 10:56
    You can't do it that way.

    What you can do is to create a low level object that just contains constant definitions ... and one dummy PUB method. The dummy method will take a few bytes, but won't be duplicated each time you include this object in others. You include this object in any higher level objects that need to reference one or more of the constants.
  • Heater.Heater. Posts: 21,230
    edited 2011-11-22 10:59
    You could create an object with nothing in it but your constants and use that object in all others that need the constants.
  • Don PomplunDon Pomplun Posts: 116
    edited 2011-11-22 11:33
    That's what I was afraid of, though not Real Fear. Thanx.
Sign In or Register to comment.