From: Compaq C/C++ Team <compaq_c@zko.dec.com>
Subject: Re: Compaq's c++ succesfully runs under Debian woody
Date: 2000/04/04 [thread overview]
Message-ID: <38EA7792.167E@zko.dec.com> (raw)
In-Reply-To: 38E9DC27.CA28D3C6@ife.ee.ethz.ch
Alex Rhomberg wrote:
>
> The description from Compaq seems to indicate that you could use
>
> #if defined(__DECC_VER) || defined(__DECCXX_VER)
>
> #endif
>
> To determine the compiler at compile time. No command lines needed
>
> - Alex
Right.
No guarantees on code quality/style, but if you wanted to printf
the name of the compiler and its version, handing Compaq C/C++
and gcc/g++, one way might be as follows:
%cat ver.c
#if defined(__DECC_VER) || defined(__DECCXX_VER)
# define VERletnum(x) (((x)/10000) % 10)
# define VERletter(x) (VERletnum(x) == 9 ? 'V' \
: VERletnum(x) == 6 ? 'T' \
: 'X' )
# define VERmajor(x) ((x)/10000000)
# define VERminor(x) (((x)/100000) %100)
# define VERedit(x) ((x) % 10000)
# if defined(__DECC_VER)
# define VERname "Compaq C"
# define VERnum __DECC_VER
# else
# define VERname "Compaq C++"
# define VERnum __DECCXX_VER
# endif
# define VERPRINT() printf("%s %c%d.%d-%03d\n", \
VERname, VERletter(VERnum), \
VERmajor(VERnum), VERminor(VERnum), \
VERedit(VERnum))
#elif defined(__GNUC__)
# ifdef __cplusplus
# define VERname "g++"
# else
# define VERname "gcc"
# endif
# define VERPRINT() printf("%s %d.%d\n", VERname, \
__GNUC__, __GNUC_MINOR__)
#else
# define VERPRINT() printf("UNKNOWN compiler\n")
#endif
#include <stdio.h>
int main(void)
{
VERPRINT();
return 0;
}
% gcc ver.c
% ./a.out
gcc 2.90
% g++ ver.c
% ./a.out
g++ 2.90
% ccc ver.c
% ./a.out
Compaq C V6.2-002
% cxx -x cxx ver.c
This beta test software will expire on April 15, 2000.
Please contact Compaq to receive a more recent version.
% ./a.out
Compaq C++ T6.3-003
Of course, if you were going to provide the version of the
compiler for the purpose of reporting a problem, you would
want to invoke the Compaq compilers with the -V option,
or the GNU compilers with the --version option.
- Compaq C/C++ Team
next prev parent reply other threads:[~2000-04-04 4:00 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-04-01 5:00 Compaq's c++ succesfully runs under Debian woody Abraham Theodorus Stolk
2000-04-03 4:00 ` Compaq C/C++ Team
2000-04-04 4:00 ` Greg Lindahl
2000-04-04 4:00 ` Bram Stolk
2000-04-04 4:00 ` Alex Rhomberg
2000-04-04 4:00 ` Compaq C/C++ Team [this message]
2000-04-04 4:00 ` Bram Stolk
2000-04-07 4:00 ` Abraham Theodorus Stolk
2000-04-09 4:00 ` James Macnicol
2000-04-09 4:00 ` Abraham Theodorus Stolk
2000-04-10 4:00 ` James Macnicol
2000-04-10 4:00 ` Compaq c++ compiler and debian's binutils Bram Stolk
2000-04-10 4:00 ` Goswin Brederlow
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox