Do you use a type of define'd flag system for your projects?

Programming, for all ages and all languages.
Post Reply
earlz
Member
Member
Posts: 1546
Joined: Thu Jul 07, 2005 11:00 pm
Contact:

Do you use a type of define'd flag system for your projects?

Post by earlz »

I have realized that I use a #define'd system for configuration, the thing that's weird, is I have two of these flags in common with nearly every project I make..
one is
"LOW_MEMORY" which when defined will attempt to conserve memory at all costs

and then I got "SPEED_UP" which when defined will use potentially unsafe optimizations; also, it will attempt to do more caching and will optimize for CPU time fastness...this bascially doesn't go along with LOW_MEMORY, but anyway...

does anyone else do things this way for every project?
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Post by neon »

I sometimes do. I useually create #defines to help portability,
and create different modes (Debug, release). I sometimes
define COMPACT, which is simular to your LOW_MEMORY directive.
frank
Member
Member
Posts: 729
Joined: Sat Dec 30, 2006 2:31 pm
Location: East Coast, USA

Post by frank »

I use a DEBUG define when I need the code to print out a lot of debugging information.
User avatar
Brynet-Inc
Member
Member
Posts: 2426
Joined: Tue Oct 17, 2006 9:29 pm
Libera.chat IRC: brynet
Location: Canada
Contact:

Post by Brynet-Inc »

DEBUG is quite common, Using defines for portability is also helpful..

Notably being able to add OS specific patches.. or workarounds for compiler versions etc..

Here is a handy site to find some common defines 8)

http://predef.sourceforge.net/

Autoconf is one viable way to check what is and what is not available on a specific system..
Image
Twitter: @canadianbryan. Award by smcerm, I stole it. Original was larger.
Post Reply