Page 1 of 1

Compiler talk

Posted: Fri May 01, 2015 5:49 am
by gamenovice
Hey guys,

So I've been using gcc and g++ for god knows how long now, but every now and then I hear terms like clang, and kinda wonder what all compilers are out there (for now only c/c++) and which would be best to use in some cases. If you guys have any info, I'd love to know.

Also according to falco, gcc sucks ass but I don't really know why...

Re: Compiler talk

Posted: Fri May 01, 2015 5:23 pm
by dandymcgee
Real men write their own compilers.

On a more serious note, I've only ever used gcc a few times. Most of my development is done in Visual Studio, so I use the built-in compiler.

Re: Compiler talk

Posted: Fri May 01, 2015 5:39 pm
by gamenovice
dandymcgee wrote:Real men write their own compilers.

On a more serious note, I've only ever used gcc a few times. Most of my development is done in Visual Studio, so I use the built-in compiler.
Funnily enough i found a couple of wikibooks about writing your own compiler, which I'll be going through sometime this summer (after I get the snes assembly working...took forever to compile the binaries for it).
links here:
http://en.wikibooks.org/wiki/Compiler_Construction
http://en.wikibooks.org/wiki/How_to_Write_a_Compiler

I actually do what i can to avoid IDEs like the plague, mainly because it feels more satisfying knowing exactly where and how I'm building out my source files and linking everything. That and everytime I try to link dlls or libs using visual studio, i swear to god the interface for doing that makes me feel dyslexic (i always have to rewatch tutorials on how to do it for some reason :\)

Re: Compiler talk

Posted: Tue May 05, 2015 10:57 pm
by Falco Girgis
GCC isn't so bad if you're on Linux or a Mac, but it's a horrible piece of shit on Windows (MinGW), and considering the fact its main benefit to a developer is platform independence, I would dare say that's pretty shitty. Unfortunately pretty much every microprocessor and operating system supports GCC as its primary compiler, so it's not like it'll go anywhere anytime soon... I pretty much want to throw my Macbook through the fucking WIndows when it takes 15+ minutes to do a fresh build on ESTk, and it's 3+ minutes just to link the executable after I change a single line. Then the exact same code on the exact same machine compiles and links in just a few minutes when I boot to my OSX partition... MinGW (Minimal GCC for Windows) is notoriously shittily written and does all kinds of asinine dynamic memory allocations in the background slowing everything down... It's a slow resource hog.

Fortunately CLANG is really starting to gain some grounding, at least on Linux and OSX. It's supposedly compatible with GCC object code, supports almost every feature of GCC, and it is FAR less of a resource hog. It's actually pretty damn impressive... It's also outperforming GCC-compiled executables in terms of size and speed as well.

I was a Visual Studio loyalist for about 5 years, back during Visual Studio 2010. It's a great compiler, really offering an unbeatable development environment on Windows that is a billion times more user-friendly than XCode on OSX or Make/CMake on Linux systems. Unfortunately it's platform dependent (although supposedly this is now changing), and it was very slow to implement the C++11 standard, which pushed me away years ago.

I swear by Qt Creator as my multiplatform IDE. It's by far the most intuitive environment, utilizing MinGW on Windows, and GCC or CLANG on OSX and Linux as its back-end compiler. The Qt "project files" offer an almost Makefile-like level of control over the build process without the hassle of writing your own (Qt basically converts your project to a makefile for you)... and unlike Code::Blocks and every other "supposedly" cross-platform IDE, Qt Creator ACTUALLY works identically on each platform, which is insanely important to me considering how many builds we're supporting with ES.

So there's my 2 cents...

Re: Compiler talk

Posted: Wed May 06, 2015 1:08 am
by gamenovice
so crossplatform aside, what reasons would I choose visual studio over Qt?

Re: Compiler talk

Posted: Wed May 06, 2015 8:48 pm
by dandymcgee
gamenovice wrote:so crossplatform aside, what reasons would I choose visual studio over Qt?
For C++, I can't think of a single reason. Both have incredible debuggers and are great environments for general purpose development

I do most of my work (job work) in C#, which obviously requires Visual Studio. The amount of shit it does for you is an insane time-saver for rapid prototyping and rapid development. When you're writing an application that runs on $10,000 dedicated server a few times a day, your boss doesn't really give a fuck if it takes 0.2 seconds or 3 minutes to analyze yesterday's data. Your boss cares about how many hours you're going to spend writing it.

So basically:
Windows development? Visual Studio.
Cross-platform? Qt Creator.

Everything else is personal preference. Try them both, you'll undoubtedly like one better.

Re: Compiler talk

Posted: Tue May 12, 2015 2:27 am
by K-Bal
Maybe you should just stop worrying about this. Use something that fulfills all your needs. You might come to point where you realize your compiler is not the right tool. That is the right point to start looking for alternatives.

Personally, I'm using QtCreator with GCC on Linux at work and at home, although I don't really have big projects for which I care a lot about compile time. I also have a clang compiler environment set up, just in case I want to compare some builds.

Btw, I also lately became a fan of clang-format. I can't imagine coding without it anymore.