C #define Equivalent?

Everything else that doesn't fall into one of the other PB categories.
Steve Elliott2
User
User
Posts: 42
Joined: Sat Jun 20, 2015 1:47 pm

C #define Equivalent?

Post by Steve Elliott2 »

Is there a Pure BASIC equivalent of C's pre-processor #define statement?

I know we can do this with variables - but not for other text substitutions?

Code: Select all

eg)

#Sound_Loop = #PB_Sound_Loop
User avatar
spikey
Addict
Addict
Posts: 810
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Re: C #define Equivalent?

Post by spikey »

Depends which function of #define you need to use.

You can define constants and enumerations, including string constants:-
http://www.purebasic.com/documentation/ ... tants.html

or parameterized identifiers using macros:-
http://www.purebasic.com/documentation/ ... acros.html

oh and you can check for pre-existing stuff (except macros) with the compiler function Defined.
http://www.purebasic.com/documentation/ ... tions.html
Steve Elliott2
User
User
Posts: 42
Joined: Sat Jun 20, 2015 1:47 pm

Re: C #define Equivalent?

Post by Steve Elliott2 »

Macro was what I was after - many thanks! :D
Post Reply