Run-Time Support

Bjarne Stroustrup mentions, "Except for the 'new', 'delete', 'typeid', 'dynamic_cast' and 'throw' operators, and the 'try'-block, individual C++ expressions and statements need no run-time support."

What does this mean in terms of systems programs for PC? If I were to write a program with none of those language facilities, could I potentially just compile my program, give the .exe to someone and they could run it on their computer without downloading any of those C++ runtime frameworks? When I deployed a previous program, I had to use Flexera software to package it so that when someone opened the file, they'd get the necessary run-time support files. Was Flexera packaging only necessary because I used one, or some, of these previously mentioned language features?
Without runtime support your programm cannot have any kind of input or output. You cannot have a simple "Hello world" to the console. It just doesn't make sense.

If I were to write a program with none of those language facilities, could I potentially just compile my program, give the .exe to someone and they could run it on their computer without downloading any of those C++ runtime frameworks?
Since those basic runtime libraries are usually present, you will most likely be able to do so with runtime support.

In you project you can choose whether you want to link the runtime statically or dynamically. If you link statically the program is bigger but self content and does not require further dll.

Was Flexera packaging only necessary because I used one, or some, of these previously mentioned language features?
It is the same as the runtime library: If you link statically the program becomes bigger but does not need further dll. If you link dynamically and the dll is not present at the other computer you need to provide the dll.
Hi Coder777,

Thanks for the reply. Your statement


Without runtime support your programm cannot have any kind of input or output. You cannot have a simple "Hello world" to the console. It just doesn't make sense.


seems to directly contradict Bjarne Stroustrups assertion that

Except for the 'new', 'delete', 'typeid', 'dynamic_cast' and 'throw' operators, and the 'try'-block, individual C++ expressions and statements need no run-time support.
Because "cout" is not mentioned in that list, I'd assume it does not need run-time support, so I could, infact, write a hello world program with no run-time support.

I'm not trying to be combative, just trying to figure out the difference between what you mean by run-time support and what Bjarne means when he says run-time support.
Last edited on
Bump.
> Because "cout" is not mentioned in that list, I'd assume it does not need run-time support,
> so I could, infact, write a hello world program with no run-time support.

Stroustrup states that "individual C++ expressions and statements" other than those mentioned require no run-time support.

What this means is that for these, executable machine level instructions are generated at compile time; no extra run-time environment or library over and above the basic platform/hardware on which the program runs is required.

std::cout requires the support of a run-time library, the header <iostream> need not be (typically would not be) available in freestanding implementations.

Two kinds of implementations are defined: a hosted implementation and a freestanding implementation. For a hosted implementation, this International Standard defines the set of available libraries. A freestanding implementation is one in which execution may take place without the benefit of an operating system, and has an implementation-defined set of libraries that includes certain language-support libraries.
...
A freestanding implementation has an implementation-defined set of headers. This set shall include at least the headers shown in Table 19. - IS


The headers listed in table 19 include a few that require run-time support for language features; for instance the headers <new>, <exception> and <typeinfo>

For instance, in the GNU implementation, there are two libraries: libsupc++ required by all implementations including freestanding implementations (support for language features like dynamic memory management, run-time type information and exception handling) and libstdc++ (the rest of the standard library for hosted implementations).
Whether the runtime library (or any other library) is needed depends on whether the compiler is able to resove an expression entirely or not.

An expression like new needs runtime support because the compiler as such does not know how to allocate memory. The same applies to any input/output functions/objects.

However, you can provide your own implementations for the unresolved implementation, though I wouldn't recommend this.
Thanks, you guys. This makes sense.
Topic archived. No new replies allowed.