How do you create a freestanding C++ program?

后端 未结 7 922
予麋鹿
予麋鹿 2021-02-02 02:11

I\'m just wondering how you create a freestanding program in C++?

Edit: By freestanding I mean a program that doesn\'t run in a hosted envrioment (eg.

7条回答
  •  不知归路
    2021-02-02 02:49

    C++ is used in embedded systems programming, even to write OS kernels.

    Usually you have at least a few assembler instructions early in the boot sequence. A few things are just easier to express that way, or there may be reference code from the CPU vendor you need to use.

    For the initial boot process, you won't be able to use the standard library. No exceptions, RTII, new/delete. It's back to "C with classes". Most people just use C here.

    Once you have enough supporting infrastructure loaded though, you can use whatever parts of the standard library you can port.

提交回复
热议问题