#define
AGCB
Posts: 327
I was looking at an object the other day to learn from the coding of the writer and came across this
I remember this from when I used to program PICs but have never seen it in a propeller program. I looked in the propeller manual and could not find anything. Upon trying to compile the object, it gave an error. It seemed to be a regular SPIN program
Would someone enlighten me as to why, how what etc.?
Thanks.
Aaron
#ifdefine xxxx ...code... endif
I remember this from when I used to program PICs but have never seen it in a propeller program. I looked in the propeller manual and could not find anything. Upon trying to compile the object, it gave an error. It seemed to be a regular SPIN program
Would someone enlighten me as to why, how what etc.?
Thanks.
Aaron
Comments
Spin from Parallax, as in the Propeller Tool, does not have such a construct.
Spin compilers created by others, like BST, have added features to the language. Like #define for example.
"#ifdefine" comes from the archaic C language. (Where is was "ifdef...")
Basically the idea is that you may want to include or exclude different bits of code at compile time according to some definitions given to the compiler when you run it. Those definitions can also be included in the code "#define useSomeFeature 1" for example.
Hmm...if you are posting that code correctly you cannot be trying to compile C which has "#ifdef" not "#ifdefine".
It was always speculated that adding features to Spin would cause confusion. Many years later here we are:)
What is the Spin object you are building?
Well, yeah. Spin is not C. It's a different language.
I know your pain. Spin is not C and it confuses old C hands. It especially trips you up when swapping between Spin and C in a hurry.
Of course no body knows what the operators in C++ mean, they are overridable.
And good luck with Javascript
And this is an OBJ block from a child object
I just wondered if I was missing something as I've not seen this in a spin program before although the same thing is used in the Microchip PIC MPLAB IDE.
Thanks
Aaron
But, don't despair. Both work nicely. Catalina C used homespun up until the latest versions. I use bst to compile ZiCog.