473,386 Members | 1,820 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Least Common Denominator Feature Set

I often encounter statements in documentation or comments in source code
that says things along the lines of "not all compilers support X, so we did
not use it." X might be namespaces, dynamic_cast, templates, RTTI, etc. Is
this a common situation for a lot of C++ development? Are there some major
platforms that lack good C++ compiler support?

Sometimes I have the sense the guideline or decision was made years ago, and
never revised to address progress in compiler support. Is that a likely
scenerio?

--
STH
Hatton's Law: "There is only One inviolable Law"
KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com
Mozilla: http://www.mozilla.org
Jul 22 '05 #1
5 2852
Steven T. Hatton wrote:
I often encounter statements in documentation or comments in source code
that says things along the lines of "not all compilers support X, so we did
not use it." X might be namespaces, dynamic_cast, templates, RTTI, etc. Is
this a common situation for a lot of C++ development? Are there some major
platforms that lack good C++ compiler support?
I can't attest to commonality, but in several places that have employed
me over the years I've encountered that often that's true. And it may
not necessarily be the platforms, but rather clients who use older C++
compilers. Of course, when we had time we'd put #ifdef all over the code
and let the "advanced" users enjoy the fuller compliance of their newer
compilers. One thing you're *not* supposed to do is to force your clients
to upgrade (whether the OS or the compiler). When they get to it, they
will do it. Unfortunately, even when they do, we usually don't have time
to go and weed out all older implementations. So, the backward-compatible
code lives on.
Sometimes I have the sense the guideline or decision was made years ago, and
never revised to address progress in compiler support. Is that a likely
scenerio?


Usually, the decision is quite generic. You either support retarder OSes
and compilers or you don't. At any given time, there will always be some
compilers and/or OSes that are advanced and some that are retarded. So,
if you decide to support the retarded ones, you're never going to get out
of that loop. Whether it's a good idea or bad is very individual because
it's your business, it's your clients, it's your money to spend on support
of those older environments.

V
Jul 22 '05 #2
"Steven T. Hatton" <su******@setidava.kushan.aa> wrote in message
news:4J********************@speakeasy.net...
I often encounter statements in documentation or comments in source code
that says things along the lines of "not all compilers support X, so we did not use it." X might be namespaces, dynamic_cast, templates, RTTI, etc. Is this a common situation for a lot of C++ development?
If you try to support multiple platforms this is a common problem. Every
compiler supports its own subset (and superset) of the C++ standard. And
even if both compilers support feature X of standard C++, it is still
possible that they produce different results (e.g. namespace resolution).
This can be because one or both compilers are not fully standard compliant
or that the standard is ambigious on the subject (and of course there is
undefined behaviour which should avoided anyway). One way to deal with this
is to avoid those features altogether (which can be impractical), another
way is to #ifdef your problem away (this can get real ugly real quickly).
Are there some major
platforms that lack good C++ compiler support?
Things are improving, fortunately.
Sometimes I have the sense the guideline or decision was made years ago, and never revised to address progress in compiler support. Is that a likely
scenerio?


Yes, I have seen coding standards that demanded that the names of public
functions should be no longer than 6 characters because there was once a
linker (10 years before) that could not handle name longer than 6
characters. For some features it took a long time before (the majority of)
compilers supported them correctly. Often the rule to avoid those
'problematic' features stays in coding standards and in peoples heads long
after the reason for that rule ceased to exist. This is one of the reasons
why it is important know the motivation behind guidelines/rules.

Another consideration is that in many places don't use the latest version
of a compiler. I know of plenty of places where they still use GCC 2.9.5,
and often for good reasons. Besides standard compliancy there are other
concerns when deciding whether or not to upgrade a compiler. Especially in
production environments changing compilers should not be taken to lightly
(if it ain't broke, don't fix it).

--
Peter van Merkerk
peter.van.merkerk(at)dse.nl

Jul 22 '05 #3
Peter van Merkerk wrote:
(if it ain't broke, don't fix it).


That may also apply to the code, not just the compiler. They may have
gone to a newer, more standards-compliant compiler, but the code is
written, documented, debugged, and tested. It may be suboptimal, given
some newer features of the language, but why bother changing it if it's
known to work properly?
Jul 22 '05 #4
"Steven T. Hatton" <su******@setidava.kushan.aa> wrote in message news:<4J********************@speakeasy.net>...
I often encounter statements in documentation or comments in source code
that says things along the lines of "not all compilers support X, so we did
not use it." X might be namespaces, dynamic_cast, templates, RTTI, etc. Is
this a common situation for a lot of C++ development? Are there some major
platforms that lack good C++ compiler support?

Sometimes I have the sense the guideline or decision was made years ago, and
never revised to address progress in compiler support. Is that a likely
scenerio?


Your suspicion, that there is an old decision involved, is probably
based in good solid fact. Many shops will have old compilers, or
they will have old code that only compiles on old compilers, etc.
Managers often see the effort to update old code as a waste. In
*some* cases, they may be right. If somebody wants to rewrite code
for the single purpose of updating it to a new coding standard,
the chances are good it's not worth it.

I have a set of rules.
- If the users (clients, etc.) are not complaining, and
- The software satisfies the specs, and
- Nothing in particular is messing up downstream, then:
don't change that code without a good reason. It's a lot of
effort to rewrite code, and you may introduce new bugs doing it.

So there may well be some ancient dinosaur of a compiler involved.

For another angle on it, someplace in one of the "big name" books
I read a story about the ubercoder. The new hire was very sorry to
have missed him, because the ubercoder had made it a point of pride
to use every single feature of the coding language in every single
project he worked on. Ubercoder knew every jot and line of the
standard, and had crawled over every nut-and-knob of the compiler,
and could make things happen that nobody else even suspected.
The new hire would have really enjoyed meeting ubercoder, excpet
he had been fired the week before the new hire started.
Socks
Jul 22 '05 #5
red floyd wrote:
Peter van Merkerk wrote:
(if it ain't broke, don't fix it).


That may also apply to the code, not just the compiler. They may have
gone to a newer, more standards-compliant compiler, but the code is
written, documented, debugged, and tested. It may be suboptimal, given
some newer features of the language, but why bother changing it if it's
known to work properly?


That sounds almost like a contagious disease. If I have a product that a
major customer uses as a development took kit, and the customer has legacy
requirements that preclude the use of certain features I may be forced to
implement my product without using the newer features of the language. If
I have other customers who use my product as a key part of their
development... And the more you add using the workaround to compensate for
the once missing language feature the deeper it gets.

I know of a situation where this kind of vicious cycle prevails. It can be
frustrating to me. I always want to be using the very latest innovations.
It's hard to stay motivated when you know there are better ways of
accomplishing what your working one, but you can't use them.
--
STH
Hatton's Law: "There is only One inviolable Law"
KDevelop: http://www.kdevelop.org SuSE: http://www.suse.com
Mozilla: http://www.mozilla.org
Jul 22 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dalan | last post by:
To avoid having potential conflicts and problems with different versions of Common Dialogs Controls, I have decided to change the ones I have used to API calls; however, this is somewhat new...
52
by: onsbomma | last post by:
I want to set and reset the least significant bit of a address (where a pointers points to). I tried this, but it is not correct: #define BIT 0x1 void foo(){ void *p; *p = *p & ~BIT
4
by: Dave Kolb | last post by:
Hi, It is possible to reference an assembly in a directory other than in the bin subdir without registering in ghe GAC? For instance, I would love to have all my web apps on one server...
6
by: Just Me | last post by:
My Task List contains the following: At least one reference is missing the 'Name' attribute. Any suggestion on how toe find which project is missing it? Solution contains 25 projects. ...
5
by: Sebastian | last post by:
Here's the thing I have a web aplication (1.1) and one of my classes has an array as a property (let's say Class A, has an ArrayList of Bs). On the other side I have a win form app which uses web...
2
by: petermichaux | last post by:
Hi, It seems like determining element position in a web page is a difficult task. In the position reporting source code I've looked at there are special fixes for at least some versions of...
22
by: David Mathog | last post by:
One thing that keeps coming up in this forum is that standard C lacks many functions which are required in a workstation or server but not possible in an embedded controller. This results in a...
7
by: cess | last post by:
Hi!!! i would like to know if what is lacking in the codes below to have a greatest common denominator of two given(by the user) numbers?? I'm confused and i need your help! import java.io.*;...
15
by: judge82 | last post by:
I'm new to Java and I was looking for some help on this particular problem. I need to create a method that can simplify a fraction, that is, represent it as a fraction where the numerator and the...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.