Shop OBEX P1 Docs P2 Docs Learn Events
New Pre-Compiler Directive — Parallax Forums

New Pre-Compiler Directive

wlegerwleger Posts: 7
edited 2011-04-12 14:31 in General Discussion
New Pre-Compiler Directive:

Defining Constants in a program can make life a lot easier. Some constants are predefined by the hardware, others are defined by the programmer and the actual value is insignificant.

Setting up a constant template can be a painful task and modifying it can be more painful, especially if you are using sequential constants.

UP CON $00
DOWN CON $01
LEFT CON $02
RIGHT CON $03
BEGIN CON $04
HALT CON $05

A long time ago I worked with a compiler (probably Microsoft C or MASM) where it had the ability to assign sequential numbering to constants. This feature made life easier and it reduced errors.

UP CON $00
DOWN CON +1
LEFT CON +1
RIGHT CON +1
BEGIN CON +1
HALT CON +1
#END

It would be nice to be able to do this with the BASIC Stamp editor because of the number of constants that we work with in automation. It would also be easier to perform program maintenance on constant templates. I have one code section with 218 user constants. To reorder this section is painful.

Just a thought for your consideration,
Bill Leger
Sign In or Register to comment.