symbolic constant

i dont see any better use of #define i mean why should i use it when i can just declare a variable using constant

constant km_per_miles=1.609;
instead of
#define km_per_miles 1.609

i just using it as header guards

1
2
ifdef
ifndef 
I agree. Using const is much better. I think using #define to define constants is an old habit from C from before the const keyword existed.
Last edited on
The #define is an instruction for preprocessor; the compiler never sees it. It has uses (like the include guards), but should not be used for what the language (C++) has intrinsic support for.
k ty

#define C "sucks"
Topic archived. No new replies allowed.