This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

EC++ and predefined version number macros

Hello,

I would like to test the version of both the EC++ and C compilers and return an #error message if they don't match what it is supposed to be. Just to make sure that no-one will compile and run the code with another toolchain without being warned.

So here it goes, in a .cpp file:

// test.cpp
#ifdef __cplusplus
#if __EC166__ != 109
#error Wrong EC++ compiler version
#endif
#endif

#if __C166__ != 0
#error Wrong C compiler version
#endif

unsigned int i;
// end of file

It compiles successfully (!) and yields the test.ic file:
// v_2.45.2, Fri Oct 28 19:01:33 2005
#line 1 "deleteme.cpp"
#line 12
unsigned i = 0;

So my question is:
How comes that __C166__ evaluates successfully to 0 when a file is compiled with EC++? To me, it is not supposed to be a predefined EC++ macro constant, and should just be expanded in the .ic file?


Of course this doesn't compile with EC++, even though that's what I would like to have:

// test.cpp
#ifdef __cplusplus
#if __EC166__ != 109
#error Wrong EC++ compiler version
#endif
#endif

#if __C166__ != 602
#error Wrong C compiler version << error here
#endif

unsigned int i;
// end of file

Even though EC++ calls the C compiler, which happens to be version 6.02...

Now this .c file:
// test.c
#ifdef __cplusplus
#if __EC166__ != 109
#error Wrong EC++ compiler version
#endif
#endif

#if __C166__ != 602
#error Wrong C compiler version
#endif

unsigned int i;
// end of file

Compiles successfully with the C compiler.



I would really like to test both the EC++ AND the C version. Is there any workaround?


Thank you very much for your help and for reading me,

-Stéphane

_______________________________

I am using the following toolchain:

IDE-Version:
µVision3 V3.21
EC++ Compiler: EC166.Exe V1.09
C Compiler: C166.Exe V6.02
Assembler: A166.Exe V5.20
Linker/Locator: L166.Exe V5.21
Librarian: LIB166.Exe V4.26
Hex Converter: OH166.Exe V4.7a
CPU DLL: S166.DLL V2.49
Dialog DLL: D167.DLL V2.45

Parents Reply Children
  • Drew,

    Thank you for your reply.

    Eventually, I think I'll use a .cpp file to test the EC++ version, and besides that, a .c file to test the C compiler version. That will take care of it. I wish I could test both things in the same .cpp file but that doesn't seem to be possible...


    -Stéphane