0

I'd like to learn C++ (I'm already aware of basic sequential programming stuff like loops, if then else stuff, pointers, references and such, but in practise I never programmed sophisticated C++-code). But before I begin learning how to do that, I'd like to learn how the C++ code is actually carried out on computers that feature a Memory and a CPU. For example, where is the code stored, where do the Objects live, in what language is the code stored in the memory, how does the computer memorize where he is in the programm, and such. Reading about those topics here on stackoverflow, I encountered terms such as "stack", "heap", "memory allocation", "pop", "push", "call", "atomic".... I however how those should fit into the overall picture, and many of the answers suggested how those exactly work is a matter of the implementation, and not specified by the c-standard.

Hence my Question: Is there a model for memory and CPU, that describes roughly how C++-Code is executed on a computer, and that is independent of any implementation compatible with the c++ standard?

Quantumwhisp
  • 223
  • 1
  • 7
  • 5
    Yes, the C++ abstract machine as specified by the ISO C++ standard gives some guarantees. But no, it's not at all specific and doesn't specify anything about a stack or registers for automatic storage the way compiling for any real target would. – Peter Cordes Mar 26 '20 at 16:28
  • 1
    You may be interested in [intro.compliance](http://eel.is/c++draft/intro.compliance) section of the C++ Standard, especially in its [intro.abstract](http://eel.is/c++draft/intro.abstract) subsection. – Daniel Langr Mar 26 '20 at 17:12
  • 1
    Also, note that we commonly speak about "stack", "heap", etc., here since practically all C++ implementations target platforms where these things exist. Technically, one should use terms like "automatic/dynamic storage duration" instead, but stack/heap is simply shorter and everyone knows what does the writer mean. Relevant question: [Are there stackless or heapless implementation of C++?](https://stackoverflow.com/q/10900885/580083). – Daniel Langr Mar 26 '20 at 17:24

0 Answers0