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

CCS support for version checking at compile time? [Solved]

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



Joined: 24 Jun 2004
Posts: 1899

View user's profile Send private message

CCS support for version checking at compile time? [Solved]
PostPosted: Fri Feb 15, 2019 3:26 pm     Reply with quote

I've searched and either I'm not using the proper keywords or what I'm looking for doesn't exist.

Does CCS have some kind of support for a compiler environment check? For example, let's say I create a project and eventually release something. I use compiler version 5.x, and leave comments in the code saying as much. A colleague then edits the project to make a minor change but uses compiler version 5.y and - for argument's sake - something breaks.

It would be useful to force the compiler to check what compiler version is actually being used, and generate an error if it's not what it is supposed to be.

I realize that I could simply put in a
Code:
#warning Version 5.x must be used!!!
but that would assume that people read compiler warnings.

Anyone know if this is supported?
newguy



Joined: 24 Jun 2004
Posts: 1899

View user's profile Send private message

PostPosted: Fri Feb 15, 2019 3:38 pm     Reply with quote

Nevermind: I knew I had seen something about compiler version checking/restriction. If you use the IDE, it's in Options->Project, General. Checkbox for "Use specific compiler version"
jeremiah



Joined: 20 Jul 2010
Posts: 1314

View user's profile Send private message

PostPosted: Fri Feb 15, 2019 6:59 pm     Reply with quote

We also do a precompiler check against the version and issue either a #warning or #error if the compiler version doesn't match.

Something like:

Code:

#if getenv("VERSION") != 5.080
   #error Using wrong compiler version
#endif
newguy



Joined: 24 Jun 2004
Posts: 1899

View user's profile Send private message

PostPosted: Sun Feb 17, 2019 2:15 pm     Reply with quote

That's exactly what I was looking for. Cheers!
bkamen



Joined: 07 Jan 2004
Posts: 1611
Location: Central Illinois, USA

View user's profile Send private message

PostPosted: Thu Feb 28, 2019 1:21 am     Reply with quote

newguy wrote:
That's exactly what I was looking for. Cheers!


Don't forget to change the OP subject to include "SOLVED" somehow.

-Ben
_________________
Dazed and confused? I don't think so. Just "plain lost" will do. :D
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