d2jsp
Log InRegister
d2jsp Forums > Off-Topic > Computers & IT > Programming & Development > Preprocessor Command And Defining Variables > C Plus Plus Language
123Next
Add Reply New Topic New Poll
Member
Posts: 31,680
Joined: Nov 10 2007
Gold: 1.00
Nov 7 2009 05:29am
Is this a legit statement?

Code
// abc.h
#ifdef ABC
int ABC = 0;
#endif

...

// abc.cpp
#define ABC
ABC = 3;


I'm about to try it, just thought of it. :)
Member
Posts: 1,995
Joined: Jun 28 2006
Gold: 7.41
Nov 7 2009 05:46am
That code snipet doesn't make syntactical sense. What exactly are you trying to do?
Member
Posts: 5,219
Joined: Oct 29 2009
Gold: 0.00
Warn: 20%
Nov 7 2009 06:15pm
Quote (Muted @ Nov 7 2009 04:29am)
Is this a legit statement?

Code
// abc.h
#ifdef ABC
int ABC = 0;
#endif

...

// abc.cpp
#define ABC
ABC = 3;


I'm about to try it, just thought of it. :)


You said you coded in C?
Member
Posts: 11,637
Joined: Feb 2 2004
Gold: 434.84
Nov 8 2009 09:52am
Quote (infinitesimal @ Nov 7 2009 08:15pm)
You said you coded in C?


You should code this in "linear algebra".
Member
Posts: 5,336
Joined: Feb 6 2005
Gold: 9.00
Nov 8 2009 10:05am
Quote (Muted @ 7 Nov 2009 14:29)
Is this a legit statement?

Code
// abc.h
#ifdef ABC
int ABC = 0;
#endif

...

// abc.cpp
#define ABC
ABC = 3;


I'm about to try it, just thought of it. :)


Its ok if you first define ABC in abc.cpp and then include abc.h before you access the variable ABC. (didnt test it but should work)
Member
Posts: 5,219
Joined: Oct 29 2009
Gold: 0.00
Warn: 20%
Nov 8 2009 03:01pm
Quote (rockonkenshin @ Nov 8 2009 08:52am)
You should code this in "linear algebra".


I code in linear algebra everyday.
Member
Posts: 6,953
Joined: Sep 27 2003
Gold: 518.50
Nov 8 2009 05:00pm
Quote (infinitesimal @ Nov 8 2009 04:01pm)
I code in linear algebra everyday.

I use linear algebra to code.
Member
Posts: 5,219
Joined: Oct 29 2009
Gold: 0.00
Warn: 20%
Nov 8 2009 05:01pm
Quote (ASBands @ Nov 8 2009 04:00pm)
I use linear algebra to code.


I use code to code.
Member
Posts: 5,336
Joined: Feb 6 2005
Gold: 9.00
Nov 8 2009 07:52pm
i code in relational algebra
Member
Posts: 5,219
Joined: Oct 29 2009
Gold: 0.00
Warn: 20%
Nov 8 2009 08:42pm
You live in Greece, huh? Bet that's nice?
Go Back To Programming & Development Topic List
123Next
Add Reply New Topic New Poll