Author Topic: pro's and pre's of compilers  (Read 26925 times)

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
pro's and pre's of compilers
« on: June 24, 2005, 09:32:27 am »
I was wondering which compiler is the best. I know that every one has its own taste for that, but what I want to know is: "what are the pro's and pre's for a compiler?"
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
pro's and pre's of compilers
« Reply #1 on: June 25, 2005, 08:59:40 am »
On windows? For Free, or commercial?

For free I'd say the VC++ Toolkit. We live in VC++ world, and everything is made to work with it. It was a pain back when I couldn't run VC++ and had to stick to MinGW.
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

Offline Urxae

  • Regular
  • ***
  • Posts: 376
pro's and pre's of compilers
« Reply #2 on: June 25, 2005, 12:08:16 pm »
Of course, if you might ever want to run you programs on anything but windows, you might want to use MinGW. It's the Windows version of GCC, which is pretty much the standard compiler on other major (though not as major as Windows, except maybe on servers) platforms: Linux, *BSD and I think also Mac OS X, but I'm not sure about the last one.

Using the same compiler on each platform should make porting stuff a lot easier, though of course you also need to keep in mind other considerations.

Anyway, stuff I like a compiler to have:
  • Free (as in price) as I'm a poor student :).
  • Multi-platform as I'm thinking about switching from Win2K to Ubuntu for my machine.
  • Standard compliance (for instance, VC++ 6 is particularly bad about this I've heard, though VC++ 7(.1) is much better, and I presume the free toolkit also. GCC/MinGW is also pretty compliant, though not many compilers can claim full compliance until anyone but Comeau implements the export keyword)[/list:u]

    Can you tell I like MinGW?  :wink:

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
pro's and pre's of compilers
« Reply #3 on: June 25, 2005, 12:57:03 pm »
Why do people assume that code written for VC++ can't be ported? It's the libraries, and syntax you use that counts.

I used DevC++ and MingW for years, and I loved it. But the problem with coding windows stuff, is that nothing is designed to work with it, it's all in VC++ format, and you have to port it over, or rely on someone else porting it over, such as DirectX. Trying to use it under MingW is a nightmare. Even the ports don't work correctly.

If you're going to compile something under *nix, you will be booting up into the os, and running the native gcc anyways.
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
pro's and pre's of compilers
« Reply #4 on: June 25, 2005, 02:06:52 pm »
Quote from: fvbommel
Can you tell I like MinGW?  :wink:
You like MinGW :P

I am working on Windows righ now, and using MinGW, I like it a lot, but what about compile time, and size of compiled code? What about debug possibilities, and so on..

An what Vampyre_Dark says is true. You can make Multi platform apps with MS compiler/borland compiler, it is the way you are programming it.
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline Urxae

  • Regular
  • ***
  • Posts: 376
pro's and pre's of compilers
« Reply #5 on: June 25, 2005, 02:08:01 pm »
First of all, I didn't say it can't be ported, I just said it would be easier if you could use the same compiler on all the platforms.
I've read a lot of thread on other forums by people trying to port their programs to Linux/BSD/whatever and the fact they used VC++ factored into it, if only because they did use VC++-specific stuff. If it's there, a lot of people will use it and either not even realize it's not portable or not care it isn't until it's too late.

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
pro's and pre's of compilers
« Reply #6 on: June 25, 2005, 02:27:52 pm »
I am downloading the other compilers which are supported by C::B. I am going to compile wxWidgets and going to time it, and look what the size is...
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
pro's and pre's of compilers
« Reply #7 on: June 25, 2005, 03:51:22 pm »
Quote from: fvbommel
First of all, I didn't say it can't be ported, I just said it would be easier if you could use the same compiler on all the platforms.
I've read a lot of thread on other forums by people trying to port their programs to Linux/BSD/whatever and the fact they used VC++ factored into it, if only because they did use VC++-specific stuff. If it's there, a lot of people will use it and either not even realize it's not portable or not care it isn't until it's too late.
It wasn't the fact that they used VC++, it was the fact that they used windows specific code and libraries. The same is possible is MinGW and just as easy.

If you use SDL, and OpenGL in VC++, it's not any less portable than MinGW. However, the VC++ toolkit makes it easy to actually use all the windows stuff(like DirectX) out there, where supporting MinGW is a non factor.

I think it gives better error and warning messages too. :oops: MSInput said he wanted to compile wxwindows anyways, so perhaps those were moot points.
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
pro's and pre's of compilers
« Reply #8 on: June 25, 2005, 05:12:10 pm »
Quote from: mispunt
I am downloading the other compilers which are supported by C::B. I am going to compile wxWidgets and going to time it, and look what the size is...

To save you the trouble (for other than educational purposes), check this page for wxWidgets compile speed comparison between most major compilers.
And the winner is... DigitalMars, hands-down :)
I mean, 2.5 minutes to build wxWidgets is just awesome!

Yiannis.
Be patient!
This bug will be fixed soon...

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
pro's and pre's of compilers
« Reply #9 on: June 25, 2005, 07:54:11 pm »
gcc it is, undoubtly.

It may not always do  the very fastest compiling, and it may not always be the top performer, granted.
However, it is unarguably the best general and portable compiler suite by design and philosophy.
First of all, a compiler should be correct, and then it should be optimized, as a correct compiler enables you to produce much better code in the end.

One of the major design failures in wxWindows in my opinion is that they use macros for everything and reimplement STL functionality with custom classes. The reason they state is "portability".
The real reason is templates *are* portable, and the STL *is* portable (well, 95%), only MSVC is utterly broken.
By using and supporting MSVC, you prove them correct and further the development of incorrect software. At the same time, you prevent others from writing correct code because they must take VC into account.
It is like designing a web page for Internet Explorer. If you "optimize" your web sites for Internet Explorer, then your markup is not only incorrect, it also encourages the production of web browsers which honour flashy features higher than security and standard compliance. And, more seriously, you penaltize those browsers that are actually correct, as these will not show the pages the way people expect them.

For this reason, and to honour the free time the gcc developers sacrifice to produce a really good product (which they give to the world for free), one should use gcc.

Call me a Hippie if you like, I don't mind (and yes, I use OpenGL, too)  :)

Executable speed may be an issue for some, however, the really big difference in performance lies in entirely other things, anyway. The actual gains by using another compiler are rather small. Other things can easily make a difference of factor 2, 10, 100, or 1000, where compilers make a difference of 5%. Think of algorithm complexity, multiple API layers, cache misses, page faults, synchronous disk access... the compiler is really the smallest factor here.

Compile times, well, yes, gcc is somewhat slow. But you have to be fair and admit that at least some of this is due to precompilation. If you have gcc precompile your headers, your compile times are somewhat faster, too. Unluckily, the one thing that would benefit most from that is wx again, and wx throws up errors on precompilation.
Either way, most of my projects build in 20-40 seconds on gcc (without optimizations of course), and when only changing 1-2 files, it takes some 3-4 seconds, which is quite acceptable. What difference does it make if one single file compiles in 1.1 or 1.5 seconds.
If an optimized revision build takes 5-6 minutes, so what... you don't do that 50 times per day ;)

As a sidenote, I am curious to see how things will change with gcc 4.0, as the optimizer has seen a major overhaul and the 4.0 version supports auto-vectorization (is there any other compiler supporting this?). The effect of auto-vectorization may be zero for many applications, but it may as well be a great benefit for anything that processes mid-size or large-size streams of data. As it happens, it may save me a lot of hand-coded SSE assembly (which the compiler possibly can do better, too).
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
pro's and pre's of compilers
« Reply #10 on: June 25, 2005, 08:00:15 pm »
Quote from: thomas
By using and supporting MSVC, you prove them correct and further the development of incorrect software. At the same time, you prevent others from writing correct code because they must take VC into account.
Fud based on old info. The new VC++ since 2002~2003 is 98% standards compliant.

(And yes, OpenGL rules)
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

Anonymous

  • Guest
pro's and pre's of compilers
« Reply #11 on: June 25, 2005, 10:07:47 pm »
Quote from: Vampyre_Dark
Quote from: thomas
By using and supporting MSVC, you prove them correct and further the development of incorrect software. At the same time, you prevent others from writing correct code because they must take VC into account.
Fud based on old info. The new VC++ since 2002~2003 is 98% standards compliant.

(And yes, OpenGL rules)


He was mainly referring to VC6. The wxWidgets devs have to make all changes in the library backwards compatible to MSVC6, hence the custom classes (which since wx2.6.0 inherit from their STL counterparts by default) and no-template code in general.

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: pro's and pre's of compilers
« Reply #12 on: August 16, 2005, 10:03:44 pm »
it's all in VC++ format, and you have to port it over, or rely on someone else porting it over, such as DirectX

Uh... Direct what?  :?

No seriously, for DirectX and dotNet, the Microsoft tools are of course unbeatable. No doubt.

But for everything I want to use, and every application I want to develop gcc is the choice. Sorry, but VC simply lacks the coolness factor of gcc in many respects. And OpenGL is better than DirectX anyway :)
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

Offline Ceniza

  • Developer
  • Lives here!
  • *****
  • Posts: 1441
    • CenizaSOFT
Re: pro's and pre's of compilers
« Reply #13 on: August 17, 2005, 05:59:24 am »
Heh, you're replying to a post on June 25 with a post on August 16...

Quote from: Urxae
...and I think also Mac OS X, but I'm not sure about the last one.

Yep, GCC is also there, it's like... everywhere.

Most compilers are close to be 100% ISO C++ standard compliant nowdays. That's something you shouldn't worry about if you're getting an up-to-date compiler.

Digital Mars is really speedy compiling but still needs more "support" (I was unable to get a monolithic and shared wxWidgets without debugging with it) and it's free.

Visual C++ is also fast compiling and a good choice if you're going to focus just on Windows development. If you want to get the most of it you must pay (to stay legal).

Intel C++ is considered to be the best compiler generating binary code. It's available for both Windows and Linux. If want to use it under Linux you can get a free license for non-commercial use. For Windows you need Visual C++ and you need to pay for a license.

GCC, just like I said before, is basically everywhere. It generates nice binary code and is free. Its pitfall, as you have said, is compiling time. It's maybe the slowest C++ compiler, even though it's kinda speedy for C.

For me GCC gets the job done... with time.

GCC 4.0.x looks really promising (with the new C++ parser and SSA) but is still buggy and GCC 4.1.x looks even more promising (with the new C parser) with its first release almost out.

Cannot comment about Borland 'cause the only C/C++ compiler I've used made by them was Turbo C++, and it's really really REALLY old (nice to start learning and has a nice debugger).

Well, that's all I have to say before I fall asleep.
« Last Edit: August 17, 2005, 07:01:03 am by Ceniza »

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
Re: pro's and pre's of compilers
« Reply #14 on: August 17, 2005, 06:38:02 am »
it's all in VC++ format, and you have to port it over, or rely on someone else porting it over, such as DirectX

Uh... Direct what?  :?

No seriously, for DirectX and dotNet, the Microsoft tools are of course unbeatable. No doubt.

But for everything I want to use, and every application I want to develop gcc is the choice. Sorry, but VC simply lacks the coolness factor of gcc in many respects. And OpenGL is better than DirectX anyway :)
Like I said before. I use OpenGL for rendering, but I use DirectInput and DirectSound too. OpenGL is only a rendering library. DirectX can't be directly compared, as it offers a ton of other stuff, Direct3D being the rendering api. I tried using other things before, SDL and others, but they didn't mesaure up IMO and I'm no longer a fan of the restricted xgpl, so I don't agree to their licensing terms.

What coolness factor? What's cool about a compiler? You use the tool that meets your needs. MinGW met mine for a few years, but it was time to move on for my own needs. It's a personal choice.

btw, dotnet can go #%&*($#% :)
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~