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 CCS Technical Support

#PRAGMA ONCE support ?

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



Joined: 12 Jun 2007
Posts: 1

View user's profile Send private message

#PRAGMA ONCE support ?
PostPosted: Tue Apr 17, 2012 8:38 am     Reply with quote

Hi,

i have CCS v3.249 and i have tried

#PRAGMA ONCE

but it is not suppoted,
is there any other pre-processor command to easily prevent recursive includes ?
Ttelmah



Joined: 11 Mar 2010
Posts: 19539

View user's profile Send private message

PostPosted: Tue Apr 17, 2012 9:07 am     Reply with quote

#PRAGMA is not supported at all. It really drives me mad to see the number of people using this, without just reading the manual. Remember CCS does not have a pre-compile 'pass' as such... Smile

#PRAGMA ONCE, is not a standard feature of C. It is widely supported, but actually gives different results on some compilers, so should only be used with great caution, even when apparently supported...

The 'historical' way to do this, is to always write your include files to check if they are already loaded. So just have:
Code:

//Include file for LCD
#ifndef MYLCD_INCLUDE
#define MYLCD_INCLUDE

//code

#endif


Three lines in each file - perhaps use the filename as the #define.

Best Wishes
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