From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111c93,551288287baf9a1c X-Google-Attributes: gid111c93,public From: Compaq C/C++ Team Subject: Re: Compaq's c++ succesfully runs under Debian woody Date: 2000/04/04 Message-ID: <38EA7792.167E@zko.dec.com>#1/1 X-Deja-AN: 606803078 Content-Transfer-Encoding: 7bit References: <38E920AA.41C6@zko.dec.com> <8cbglq0ebg@news2.newsguy.com> <38E9CA3C.7A410047@sara.nl> <38E9DC27.CA28D3C6@ife.ee.ethz.ch> Content-Type: text/plain; charset=us-ascii X-Complaints-To: iass@lead.zk3.dec.com X-Trace: lead.zk3.dec.com 954890131 16383 16.31.32.198 (4 Apr 2000 23:15:31 GMT) Mime-Version: 1.0 NNTP-Posting-Date: 4 Apr 2000 23:15:31 GMT Newsgroups: comp.os.linux.alpha 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 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