peoro
peoro

Reputation: 26060

What C++(98/03) features are not-so-well supported by poor compilers?

Often I read of some software cutting out some C++ features in order to be compliant with poor/old/exotic C++ compilers.

This one is just the last one I got into: Box2D isn't using namespaces because they need to support:

poor C++ compilers where namespace support can be spotty

A bigger example I can think of is Qt, which is relying upon MOC, is limiting template usage a lot and is avoiding templates (well, this is at least true for Qt3 and previous versions, Qt4 is mostly doing that to keep to their conventions).


I'm wondering what compilers are that poor?
There are lots of C++ compilers out there (I never heard of most of them), but I would hope that all of them are supporting most common(/simple?) C++ features like namespaces (unless they're dead); isn't this the case?

What are the most unsupported features?
I can easily expect the lack of external templates, maybe template partial specialization and similar features. At most even RTTI or exceptions, but I would have never suspected of namespaces.

Upvotes: 9

Views: 1635

Answers (7)

Edward Strange
Edward Strange

Reputation: 40859

In my experience, people are just scared of new things and especially things that broke on them once, 20 decades ago. There's no valid reason against using namespaces in anything written during this century.

If you're looking for things to toss out though, if you happened to be targeting windows not too long ago you had to do more than just toss features out of C++ and not use them, you had to use different syntax. Templates come to mind as one of the worse supported features in VC. They've gotten much better but still fail sometimes.

Another one that is not supported by that particular compiler (STILL!) is overloading virtual functions to return derived type pointers to the types the base version returned when using MI. VC just plain freaks out and you end up having to do virtual_xxx() and providing non-virtual "xxx()" functions to replicate the standard behavior.

Upvotes: 7

Prasoon Saurav
Prasoon Saurav

Reputation: 92864

Value Initialization (C++03 feature) is not properly implemented in MSVC++.

Upvotes: 1

Loki Astari
Loki Astari

Reputation: 264401

If you are programming in the main stream with a main stream compiler then usually you find everything in the C++03 standard supported (except export as mentioned by sbi (but then again nobody used the feature (as it was not supported)). The further from the main stream the compiler is the less features usually (but they are all moving forward (some more slowly than others))

Its only when you get to less used hardware that has its own proprietary compiler that support for features start to dwindle.

The main example would be mobile devices and their associated compilers (though because of their popularity in the main stream in recent years these compilers are getting updated more quickly than before).

A secondary example would by SOC devices. There compilers are so specific that they are usually in house compilers and only get as much work on them as the SOC company can afford and as a result tend to lag a long way (or at least further) behind other compilers.

Upvotes: 1

Puppy
Puppy

Reputation: 146920

Namespaces have been around forever. Some of the darker places in templates, maybe. But namespaces? No way. Even with templates, the vast, vast majority of usage scenarios are fine. Some compilers aren't perfect (they're software), but flat out not supporting a C++03 feature that isn't export? That just doesn't happen. Most compilers extend the language, not reduce it, and are moving to support C++0x.

RTTI and exceptions are often accused of poorly efficient implementations, but not poor implementation conformance.

Upvotes: 1

sbi
sbi

Reputation: 224069

What are the most unsupported features?

Let's abstract away export, which, sadly, was an experiment that failed. Then, by count of compiler users this is probably two-phase lookup, which Visual C++ still doesn't properly implement. And VC has a lot of users.

Upvotes: 4

Billy ONeal
Billy ONeal

Reputation: 106549

Basically anything that was added as part of the standardization process in C++98. That is:

  • Templates (Not just partial specialization -- I mean all templates)
  • Exceptions (Often because this one requires runtime support/overhead -- they're often not available on things like microcontrollers)
  • Namespaces
  • RTTI

If you go even older, you can add

  • Most everything in the standard library.

Several old compilers are just plain bad; OTOH I would strongly not recommend worrying about them. There are already several good and freely available reasonably standards compliant compilers available for pretty much every platform of which I am aware (mostly via G++).

Upvotes: 2

Joshua
Joshua

Reputation: 43278

Qt doesn't use templates much because it is older than templates.

Upvotes: 0

Related Questions