top of page

Frequently Asked Questions

Anchor 1
Anchor 2
Anchor 3
Anchor 4
Anchor 5
Anchor 6
Anchor 7

What exactly does ada2cc output?

ada2cc outputs industry standard C++. This means that the output code adheres to the either the ARM or ISO "C++" standard. Whenever there is an ambiguity in the particular implementation of C++, the converter takes the path of least resistance, that is to say that the converter outputs the easier of 2 alternatives. Generally, the translator outputs one ".C" file for every package body translated and one ".H" file for each package specification.


Currently, the converter does not generate any vendor specific code, although we are open to doing so on a per "target environment" basis.

How can you translate Ada to C++?

If you keep in mind this simple mantra:


Packages aren't objects and objects aren't packages.


then it is possible. Ada and C++ take different approaches to structure and object oriented programming. So in converting, you tend to lose the advantages of the source language while not picking up the advantages of the destination languages. For example, Ada does a much better job at hiding objects than does C++. (In Ada, an object may simply be listed as "private" in the packages specification, while in C++, an object may well be declared "private", but its declaration is published for all to see and potentially access via C++ pointers.)


The converter allows for 2 approaches when dealing with the packages .vs. object problem. Specifically, when a packages is declared, ada2cc may either declare a "global" object of the same name as the package, thus enabling references which look very much like the original code, -OR- ada2cc may strip the package name, and reference objects in a more C++ fashion. The former approach works well for large programs while the latter works better for small systems where name space conflicts are unlikely.


With the advent of the ISO C++ standard, conversions have become significantly easier. ISO C++ introduces the concept of a "namespace" which, while still not an Ada package is a lot closer. ISO C++ compilers are strongly recommended if you plan to convert from Ada to C++. If your C++ compiler vendor does not support ISO C++ or the namespace keyword as an extension to their ARM compiler, find a vendor who does.

How good is the translation?

We estimate that the current version of the translator converts 90-95% of the code without hand modification. However 5% is still a lot and we are constantly making improvements. Most of the changes required are of the following nature:


Promoting nested functions.

Adding non-default constructors.

Adjusting template parameters.

Inserting system specific function calls to support real-time functions.

How are generics translated?

Generics are generally translated as C++ templates. However, it is in this area most hand repairs are necessary. This mainly has to do with the C++ compiler's ability (or lack thereof) to handle anything other than a class as a part of a template argument list. Further Ada-83, unlike C++, does not allow for the passing of function pointers as arguments, making templates a necessity.


In general, the C++ implementations of templates may be described as "immature". There seems to be too much room in the ANSI specification for interpretation. Among two notable problems we've seen in two C++ compilers are the dereferencing of user defined types in instantiated objects, and nested generics.

How about the real-time annex?

Currently the Ada verbs involved with real time processing, TASK, ACCEPT, and ENTRY, result in C++ block statements "{}" being output with a warning (as C++ comments). We are in the process of introducing Posix compliant function calls into the generated C++ code, but currently manual intervention in then required to place the appropriate system-specific function call in place to spawn child processes and rendezvous them.

What about nested subroutines?

Nested routines are translated as if C++ supports them. (None that we know of do, however). This requires manual intervention to promote them to the outermost scope of their enclosing program file -AND- promoting all the common variables from the original enclosing routine to global (although static) scope.

What platforms do you support?

The converter currently runs on the following platforms:


Linux (Kernel 2.6+, gcc/g++ 3.x+)

Windows 7

Windows 8.1

>>Please note that the output code is usable with any ARM or ISO C++ compiler on any platform. (subject to the above manual changes)

Can I get a demo copy?

Yes, we can provide a limited use version which demonstrates the abilities of the translator. (The limited version will only generate output when the input code is less than 100 lines of executable Ada.)


For more information, please contact

What do I need in order to convert an Ada program?

To convert code from Ada to C++, ada2cc needs the package body, package specification AND ALL package specifications used directly and indirectly (right on down to textio and system). The nested specifications are necessary so that USE contexts may be correctly expanded and variable dereferencing may be done correctly. If the translator cannot find a variable reference when outputting C++ code, it defaults to using the text as seen in the original Ada code. (i.e. No "*" or "->" operator for dereferencing is generated and variable cases are likely to be inconsistent.)

Anchor 8
bottom of page