Freestanding C++ - Past, Present, and Future - Ben Saks - CppCon 2019

Sdílet
Vložit
  • čas přidán 28. 05. 2024
  • CppCon.org
    Discussion & Comments: / cpp
    Presentation Materials: github.com/CppCon/CppCon2019
    -
    Freestanding C++ - Past, Present, and Future - Ben Saks - CppCon 2019
    C++ is used in a wide variety of platforms and environments, some of which don't provide all of the features described in the C++ Standard. For example, C++ features that require operating system support may be unavailable in low-end embedded systems, or when implementing an operating system itself. To help programmers write highly portable code, the C++ Standard drew a line between the “freestanding” features that should be available everywhere and the “hosted” features that might not. But the line has always been blurry. As C++ continues to develop, more and more developers are asking where and how that line should be drawn.
    This session explores the state of freestanding C++. It discusses the history behind freestanding C++, examines how it’s actually used (and not used), and looks at where it might be going in the future.
    -
    Ben Saks
    -
    Videos Filmed & Edited by Bash Films: www.BashFilms.com
    CZcams Channel Managed by Digital Medium Ltd events.digital-medium.co.uk
    *-----*
    Register Now For CppCon 2022: cppcon.org/registration/
    *-----*

Komentáře • 4

  • @goswinvonbrederlow6602
    @goswinvonbrederlow6602 Před 2 lety +2

    One thing I would like for c++ and freestanding would maybe be levels of freestanding. In freestanding C you turn on your hardware, set the stack pointer, zero out .bss and you are ready for C main(). Freestanding c++ is a lot more involved with features most users of freestanding don't want (exceptions, rtti). So I would love to have maybe level0: no new/delete, just constructor calls, alloca, really just bare hardware. level1: memory management (new, delete, malloc, free, allocators). And then it gets kind of gooey: level2a: exceptions+rtti and level2b threads. It becomes more of a feature tree. Libraries and Users can then pick a Node in the tree and use everything below. I would also love some way for new/constructors to fail without exceptions.

    • @shawnshaw9859
      @shawnshaw9859 Před rokem

      or, just provide the rust-alike no-std option with a subset library called libcore, so I can use c++ for OS and firmware development.

  • @bigboysteen7638
    @bigboysteen7638 Před 3 lety +7

    99% of the c++ standard library is inline templated stuff, like std::move or std::array, yet free standing can't have those things why? they do not require an operating system, they do not require linking to a library, so why aren't they accessible to freestanding?
    this sounds extremely foolish to me
    and since new is actually required by the standard, we could even have most containers.
    so c++ requires freestanding to have exception handling and rtti, but it can't provide std::array, what a bad language

    • @goswinvonbrederlow6602
      @goswinvonbrederlow6602 Před 2 lety +1

      I'm doing embedded work with c++ and when you start with some hardware you don't have new, you turn of exceptions and rtti because you have no code to set that up and it is complicated to do. And then start programming. 99% of the c++ standard library are right out the window at that point. You eventually implement malloc/free/new/delete but quite often you never want exceptions and rtti. And that is kind of the target audience for freestanding I feel. If you want 99% of the standard library then just link against a standard library. Freestanding doesn't mean you can't have an STL. Freestanding is where you start from to implement an STL so I think it already has too much, or rather the wrong things.