Solved

Cross platform utils

Posted on 1997-02-20
1
298 Views
Last Modified: 2010-04-15
I want to write a cross-platform utility in C, which will display the compiler that is being used and so on.
How do i come to know the compiler being used, like turboc, Microsoft or lattice?
0
Comment
Question by:Rocky020697
1 Comment
 

Accepted Solution

by:
glewis earned 20 total points
ID: 1249652
The best way to do this, and the method I have used for many years is to simply find out what symbols each compiler's preprocessor defines by default, and then do something like this:

#ifdef AZTEC_C
   ...code
#else
#ifdef MANX_C
   ...code
#else
#ifdef TURBO_C
   ...code
#else
#ifdef WATCOM
   ...code
#else
   Woah, Glenn!  Which compiler is this?
   /* Obviously, the above line causes a compilation error */
#endif
#endif
#endif
#endif


0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand and use structures in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use conditional statements in the C programming language.

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question