Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it true that big embedded companies are "forced" to use old programming standards/compilers? [closed]

Our lecturer told us that in completing our assignments, we are only allowed to use C++98 / C99 standards, by specifying the correct flags to the compiler we can ensure we don't break this rule.

I understand that this is so people can learn "real" C or C++, whichever they chose, and exercise this skill without any help from new language features whatsoever (I don't agree, but who am I to argue).

When asking my lecturer why this rule he answered (after knowing I'm not satisfied with the above answer): "because big old companies like ASML that work with embedded devices have old codebases that (will) can break when switching to C11/C++11).

I asked for a specific real world / practical example of a piece of code, that compiles both in C99/C11 (or C++98/C++11), is standard compliant (C99/C++98), but behaviorally very different when in binary form - to sum it up, the question has not been answered. If the statement that companies are stuck to old compilers and standards is true, can someone provide such piece of code that I want to see for myself?

like image 443
Gizmo Avatar asked Oct 18 '16 10:10

Gizmo


People also ask

What compilers actually do?

A compiler is a special program that translates a programming language's source code into machine code, bytecode or another programming language. The source code is typically written in a high-level, human-readable language such as Java or C++.

Why do people still use C?

In embedded systems and system programming, C is still the main language because you typically don't need objects there but more direct interface to hardward and low level things.

Does Windows have any built in compilers?

Unfortunately, there is no in-built compiler. You need to install one.

Is C++ poorly designed?

Criticism of C++ Although C++ is one of the most widespread programming languages, many prominent software engineers criticize C++ (the language, and its compilers) for being overly complex and fundamentally flawed.


2 Answers

I don't know much about the embedded world but a bit of other companies using c++ and having old hardware / platforms


It really depends on the company and the platform they use. But with some effort and open management there should be nothing against having modern c++ everywhere (from the technical point of view)

In several companies I know the developers encourage the move to modern c++ and they are moving more and more.

Sometimes you have to put some more effort in it than "just" installing a new compiler. When you need to deliver to an old platform (e.g. Debian 6) and cannot change the OS you have to manually compile the libstdc++ on that platform and deliver this with your product / have it use the specific one (there are more details but you get the point).


So while there maybe are companies stuck to old c++ because of conservative management or the developers not caring about modern c++. There are also more and more companies upgrading. And learning modern c++ is also not wrong because the "old" style is usually discouraged in companies who use modern c++.


Code maybe "break" when they switch compilers but only on the compilation level and because they used non-standard features/syntax (which some older compilers are more tolerant of). But behavior wise I don't know of something which "silently" breaks (the standard committee is actively trying to avoid this with each change) and you also get more and better warnings with better compilers.

like image 127
Hayt Avatar answered Oct 18 '22 10:10

Hayt


A product in a big company need not be out of a single code base. The code base could be dependent on many other libraries (including 3rd party).

The product code cannot be compiled with the latest compiler unless and until all its dependencies are compiled using that version of the compiler. (At least that is the case with static libraries)

So generally, it is difficult to move to the latest version of compilers for big products having large dependencies. Also there is a big testing overhead that should be incurred after the movement to the latest compiler.

The management would agree in doing the above only when ROI(Return On Investment) is good which is rarely the case for doing so with legacy code.

like image 22
Abdus Khazi Avatar answered Oct 18 '22 09:10

Abdus Khazi