Gcc4 and gcc2

I am just getting into learnng to program on Haiku, and notice a lot going on about having 2 different gcc suites. I’m wondering why they are both used? And which is better? If one is better, shouldn’t we just use that? Most importantly, how do I decide which to use for my own programs?

Since I know nothing of the difference, I stick to the gcc2 hybrid images for nightlies.

Hi,

The gcc2hybrid images are the officially supported ones. gcc2 is used because that is the only way to keep binary compatibility with BeOS. However, that is a 10 year old compiler and it lacks many features modern programs need.

So, use gcc2 if you want to build a desktop replicant, a deskbar tray icon, or some other thing that will be loaded as a system ad on (media format plugin, screensavers, are some more examples). In all other cases, you can use either gcc2 or gcc4, it shouldn’t make a big difference. Use gcc4 if you need C99,C11 or C++11 features, otherwise you can continue using gcc2.