Click to See Complete Forum and Search --> : Differences Between Compilers


LindisfarneBabe
01-28-2001, 02:39 PM
Can anyone tell me; is it normal to be able to use certain code, and to be able to do ceratain things on one C compiler, but not on another?

As you can all probably tell by my question, I'm just starting out in the world of C programing. On the computers at college I'm using a Borland compiler, and at home I'm using the compiler that came with SuSE 6.4 (think it's the GCC compiler). What I'm starting to wonder is if perhaps the compiler I've got at home on my Linux box is somehow not fully working. Code I can compile and run just fine at college, just will not compile at home without changes, usually having to leave bits out.

many thanks for any help and adivce on this.

Lindi.

[This message has been edited by LindisfarneBabe (edited 28 January 2001).]

pier
01-28-2001, 05:15 PM
I haven't had a lot of experience with Borlands compilers. When I did (a very long time ago) I didn't like it at all. It seemed like you had to do things that were really unnecessary. But, that wasn't on the part of the compiler, that would be on windows' part. And it depends on what standards you are coding under/for, and with C, you get backwards compatibility. Go to www.ansi.org. (http://www.ansi.org.) Is the web-site for the ANSI and a link for ISO. Can you turn ANSI compatibility off with borland? (don't remember) I know with certain flags you can with GCC. If I remember right, features.h. So to sum it up, you won't make the same system call under 2.4, as you would in windows. They deal with information differently. Windows has .DLL's, linux has /etc. If you do a lot of Assembly for optimization reasons i.e.the weird loops under x86 architecture, dealing with 32-bit data, have fun "porting" that to twice the size. (64-bit) You also have to keep in mind you are dealing with, in comparison, two different file systems. You are using SuSE, so I am assuming you are using ReiserFS,(good choice) Go to the ReiserFS web site to get some information on type of algorithm being used. Binary Balance tree(?) I think. Obviously different from vfat. Different file systems, different system calls, only assuming you are going to do systems programming. Well I hope that answered your question, I kind of went off subject there.

------------------
"we ought not concern philosophy with metaphysics, but with mathematics."-Boole (almost wordforword)

f'lar
01-29-2001, 02:57 PM
I don't think it's the compiler as much as the header files that they use. Borland has some nice modified header files. They aren't 100% ansi standard, but I like them. Also, Borland is probably running on a windows machine, so some code (like when you try to open a file certain ways) will have to be redone just for the different architecture.

klamath
01-29-2001, 04:16 PM
Can you turn ANSI compatibility off with borland? (don't remember) I know with certain flags you can with GCC.

By default, GCC supports a super-set of ANSI C (and doesn't follow the stupid stuff). To make it follow ANSI exactly, use '-ansi'.

Windows has .DLL's, linux has /etc

Well, those are really 2 different things. I guess the Win32 equivilent of /etc is the Registry, and the UNIX equivilent of DLLs is shared objects (SOs).

Different file systems, different system calls

For most programs (the vast majority) the specific filesystem should be completely transparent.

------------------
- Klamath
Get my GnuPG Key Here (http://klamath.dyndns.org/mykey.asc)
Looking for an open source project to contribute to? Check out the Tornado HTTP Server (http://sourceforge.net/projects/tornado)

Sterling
01-29-2001, 05:16 PM
However, the different system calls are sometimes a problem. POSIX terminal handling functions (through NCurses or VT220 control codes) are quite a bit more sophisticated than anything DOS or Windows offers in that area. The networking and multiprocessing stuff (fork() and friends) seems nicer in POSIX too, at least to me.

But in general, GNU C supports a superset of ANSI C, as Klamath mentioned. However, Borland compilers (IIRC) tend to do things in a definitely nonstandard way. Especially (for reasons I've never fully understood) their "learning" compilers.

------------------
-Sterling
"There is no Linuxnewbie.org cabal..."

Glaurung
01-31-2001, 03:56 PM
Can you post some of the code that doesn't compile with GCC?