CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

temporary undoing a #define (?)

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Felix Althaus



Joined: 09 Sep 2003
Posts: 67
Location: Winterthur, Switzerland

View user's profile Send private message

temporary undoing a #define (?)
PostPosted: Wed Jan 14, 2004 10:30 am     Reply with quote

Hello

I have this code:

#define BUTTON PIN_A1

[...]

#if(BUTTON / 8 != 5)
#error BUTTON has to be on PortA
#endif

I want to check, if BUTTON was assigned to a pin on Port A. If not a message should appear. The problem is, that in the error message BUTTON is replaced by the internal compiler value (ok, I know, the pre-processor does here what he sould do...).
Is there a way I can "undefine" BUTTON just for this time so it will print "BUTTON" instead of a number?

Many thanks
Felix
Ttelmah
Guest







Re: temporary undoing a #define (?)
PostPosted: Wed Jan 14, 2004 11:24 am     Reply with quote

Felix Althaus wrote:
Hello

I have this code:

#define BUTTON PIN_A1

[...]

#if(BUTTON / 8 != 5)
#error BUTTON has to be on PortA
#endif

I want to check, if BUTTON was assigned to a pin on Port A. If not a message should appear. The problem is, that in the error message BUTTON is replaced by the internal compiler value (ok, I know, the pre-processor does here what he sould do...).
Is there a way I can "undefine" BUTTON just for this time so it will print "BUTTON" instead of a number?

Many thanks
Felix


#if(BUTTON / 8 != 5)
#undef BUTTON
#error BUTTON has to be on PortA
#endif
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group