On Thu, 29 May 1997 14:03:05 +0300 (EET DST) Jukka Virtanen jtv@cc.hut.fi wrote:
Is it possible to tell which GPC platform and version is being used? [...] This would really help in writing portable code. What do you think?
Please check what gpc (gcc) defines now in your system.
This is most easily done by creating an empty file, say foo.p, and compiling it with the '-v' option. In a unix system, you can do this with:
# touch foo.p # gcc -v foo.p
At least in the version I compiled yesterday for the Alpha, the defines are:
/v/dunix40_alpha/gnu/gcc/2.7.2.1/lib/gcc-lib/alpha-dec-osf4.0/2.7.2.1/gpc-cpp -lang-pascal -v -nocharescape -undef -D__GNUC__=970528(2 -D__GPC__=970528(2 -D__GNUC_MINOR__=7 -D__unix__ -D__osf__ -D__alpha -D__alpha__ -D_LONGLONG -D__SYSTYPE_BSD__ -D_SYSTYPE_BSD -D__unix -D__SYSTYPE_BSD -Asystem(unix) -Asystem(xpg4) -Acpu(alpha) -Amachine(alpha) -D__LANGUAGE_C__ -D__LANGUAGE_C -DLANGUAGE_C /tmp/foo.p /tmp/ccaagopa.i GNU CPP version 970528(2.7.2.1)
So, it seems that the __GPC__ define at least will get screwed up, if it is generated like it is now.
I just tried this under DJGPP. This is what I got;
gpc version 2.0(2.7.2.1) c:/gpc/bin\gpc-cpp.exe -lang-pascal -v -nocharescape -undef -D__GNUC__=2 -D__GPC__=2 -D__GNUC_MINOR__=0(2 -D__unix__ -D__i386__ -D__GO32__ -D__MSDOS__ -D__DJGPP__=2 -D__DJGPP_MINOR__=1 -D__unix -D__i386 -D__GO32 -D__MSDOS -D__DJGPP=2 -D__DJGPP_MINOR=1 oka.pas c:\temp\ccbaaaaa GNU CPP version 2.0(2.7.2.1) (80386, BSD syntax)
I see that "__unix__" is defined. This is very worrying. If I do {$ifdef __unix__} the code gets compiled (why? I am using DOS, not unix).
If I do {$ifdef __UNIX__} the code (rightly) does not get compiled. So, this IFDEF thing is case sensitive. Isn't case sensitivity one of the C problems that we are trying to move from?
Also, I'd recommend in using the same definitions as are defined for the GCC for the same host. Why add new ones?
For the simple reason that we may not know all the definitions. I only know the definitions for DJGPP - and I am trying to produce a portable BP-compatible SYSTEM unit. How do I know what all the other GCC platforms define? What if they change? I would like us to have GPC-specific defines (at least, to identify the various GPC platforms), which are in the GPC documentation. I am surprised to find that "__unix__" is defined on my DJGPP system. I now find that it is also defined on your Alpha system (and probably every other GPC platform?). I would like us to define something more reliable than this, so that it is easier to write portable code using IFDEFs.
In the meantime, can somebody please send a copy of the defines on; EMX, Linux, Solaris ? Thanks!
Best regards, The Chief Dr Abimbola A. Olowofoyeku (The African Chief, and the Great Elephant) Author of: Chief's Installer Pro v3.50 for Win16 and Win32. Homepage: http://ourworld.compuserve.com/homepages/African_Chief/ E-mail: laa12@cc.keele.ac.uk
On Thu, 29 May 1997, The African Chief wrote:
I see that "__unix__" is defined. This is very worrying. If I do {$ifdef __unix__} the code gets compiled (why? I am using DOS, not unix).
The thing is that DJGPP is mainly a platform that emulates a Unix programming environment on DOS, to ease the porting of Unix programs to DOS. Theoretically, Unix programs should compile with minimal changes with DJGPP.
In the meantime, can somebody please send a copy of the defines on; EMX, Linux, Solaris ? Thanks!
Here it is for Linux:
gpc version 970510(2.7.2.1) /usr/lib/gcc-lib/i586-unknown-linux/2.7.2.1/gpc-cpp -lang-pascal -v -nocharescape -undef -D__GNUC__=970510(2 -D__GPC__=970510(2 -D__GNUC_MINOR__=7 -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -Asystem(unix) -Asystem(posix) -Acpu(i386) -Amachine(i386) -D__i486__ foo.p /tmp/cca04464.i GNU CPP version 970510(2.7.2.1) (i386 Linux/ELF)
Pierre Phaneuf
"The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense." - Edsger W. Dijkstra.