{"id":354098,"url":"https://github.com/kuanweeloong/BareMetalLib","last_synced_at":"2025-07-23T14:31:39.197Z","repository":{"id":215949011,"uuid":"592621592","full_name":"kuanweeloong/BareMetalLib","owner":"kuanweeloong","description":"A C++ Standard Library-like library for bare metal code","archived":false,"fork":false,"pushed_at":"2023-01-24T06:26:14.000Z","size":614,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-30T08:38:32.641Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kuanweeloong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-24T06:20:53.000Z","updated_at":"2024-07-24T23:05:45.000Z","dependencies_parsed_at":null,"dependency_job_id":"fbb1f478-5b2a-4ea2-9a03-2d206208f47d","html_url":"https://github.com/kuanweeloong/BareMetalLib","commit_stats":null,"previous_names":["kuanweeloong/baremetallib"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kuanweeloong/BareMetalLib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuanweeloong%2FBareMetalLib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuanweeloong%2FBareMetalLib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuanweeloong%2FBareMetalLib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuanweeloong%2FBareMetalLib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kuanweeloong","download_url":"https://codeload.github.com/kuanweeloong/BareMetalLib/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kuanweeloong%2FBareMetalLib/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266694326,"owners_count":23969753,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-07T16:14:51.296Z","updated_at":"2025-07-23T14:31:39.187Z","avatar_url":"https://github.com/kuanweeloong.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# BareMetalLib\n[![Build Status](https://travis-ci.org/kuanweeloong/BareMetalLib.svg?branch=master)][1]\n\n## Introduction\nBareMetalLib (BML) is an experimental, modern C++, header-only support library for bare-metal\nprogramming (e.g. OS kernels, embedded software). It is intended for use in environments where\nexceptions are disabled and the C++ standard library cannot be used - BML aims to provide\nfunctionality similar to that of the C++ standard library, but in a form more suited to bare-metal\nprogramming. Namely, it eschews the use of:\n\n- Headers from the C and C++ standard libraries, except for C11 freestanding headers\n- Exceptions (BML is `noexcept` throughout)\n- RTTI\n- Thread-local storage\n- Non-`constexpr` static objects (BML does not require any initialization at runtime)\n- Dynamic allocation via global `operator new` or `operator new[]`\n- Floating point operations\n\nApart from these bare-metal-related constraints, the following additional constraints are imposed on\nBML code:\n\n- Unsigned types cannot be used, except for bitfields. For example, sizes and indices are\n  represented using `ptrdiff_t` (instead of `size_t`, which is what the C++ standard library does).\n  This brings BML more in line with the [arithmetic section][2] of the C++ core guidelines.\n\nDue to these constraints, BML is **not** a drop-in replacement for the C++ standard library.\nHowever, other than being exception-free, user code is not expected to conform to the same\nconstraints.\n\nBML is based on [libc++][3]. This is a learning project, so please be patient!\n\n## Requirements\nBML requires a C++17 conforming compiler. It is tested on the following platforms:\n\n| Architecture | OS                      | Compiler    |\n| ------------ | ----------------------- | ----------- |\n| x86_64       | Debian Buster (*amd64*) | Clang 6.0.1 |\n| x86_64       | Debian Buster (*amd64*) | GCC 8.3.0   |\n| i386         | Debian Buster (*i386*)  | Clang 6.0.1 |\n| i386         | Debian Buster (*i386*)  | GCC 8.3.0   |\n| aarch64      | Debian Buster (*arm64*) | Clang 6.0.1 |\n| aarch64      | Debian Buster (*arm64*) | GCC 8.3.0   |\n| armv7l       | Debian Buster (*armhf*) | Clang 6.0.1 |\n| armv7l       | Debian Buster (*armhf*) | GCC 8.3.0   |\n| armv5l       | Debian Buster (*armel*) | Clang 6.0.1 |\n| armv5l       | Debian Buster (*armel*) | GCC 8.3.0   |\n\n## Quickstart\nCopy `include/bml` into your project's include path and include a BML header to get started. Some\nusage examples:\n\n#### Finding the minimum and maximum of several integers\nThis example finds the minimum and maximum of 4 integers and returns them in a tuple.\n\n\u003e ```c++\n\u003e #include \u003cbml/containers.hpp\u003e\n\u003e #include \u003cbml/utilities.hpp\u003e\n\u003e \n\u003e auto find_minmax(int i1, int i2, int i3, int i4) noexcept -\u003e bml::tuple\u003cint, int\u003e\n\u003e {\n\u003e     auto min = bml::min(i1, i2, i3, i4);\n\u003e     auto max = bml::max(i1, i2, i3, i4);\n\u003e \n\u003e     return bml::tuple(min, max);\n\u003e }\n\u003e ```\n\n#### Selecting an appropriate overload using the detection idiom\nThis example defines a `do_foo` function which calls its argument's member `foo` function if that\nargument's type defines such a function. Otherwise, it performs a generic `foo` action on its\nargument.\n\n\u003e ```c++\n\u003e #include \u003cbml/type_traits/is_detected.hpp\u003e\n\u003e #include \u003cbml/type_traits/enable_if.hpp\u003e\n\u003e #include \u003cbml/utilities/declval.hpp\u003e\n\u003e \n\u003e template \u003ctypename T\u003e\n\u003e using has_foo = decltype(bml::declval\u003cT\u003e().foo());\n\u003e \n\u003e template \u003ctypename T\u003e\n\u003e auto do_foo(T\u0026\u0026 arg) noexcept -\u003e bml::enable_if_ty\u003cbml::is_detected_v\u003chas_foo, T\u003e\u003e\n\u003e {\n\u003e     arg.foo();\n\u003e }\n\u003e \n\u003e template \u003ctypename T\u003e\n\u003e auto do_foo(T\u0026\u0026 arg) noexcept -\u003e bml::enable_if_ty\u003c!bml::is_detected_v\u003chas_foo, T\u003e\u003e\n\u003e {\n\u003e     // Do some generic foo action on arg. This is called for argument types that do not have a\n\u003e     // custom foo() member function.\n\u003e }\n\u003e ```\n\n## Documentation\nBML's documentation can be found in the [`docs/`](docs/) directory, or [online][4].\n\n## Running Tests\nBML relies on CMake for testing. Whether tests are built or not is controlled by a single CMake\noption - `BML_BUILD_TESTS`.\n\nTo run BML's tests on your own platform, run the following command (this assumes that\n`../BareMetalLib` is where the root of this repository is stored on your system):\n\n\u003e ````\n\u003e cmake -DBML_BUILD_TESTS=ON ../BareMetalLib \u0026\u0026 make \u0026\u0026 ctest\n\u003e ````\n\n## License\nBML's code is licensed under the [Apache 2.0 License with LLVM exceptions][5]. BML's documentation,\nwhich encompasses all content in the `docs/` directory, is licensed under [CC BY-SA 4.0][6].\n\nFor more details, see [LICENSE.md](LICENSE.md).\n\n[1]: https://travis-ci.org/kuanweeloong/BareMetalLib\n[2]: https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Res-mix\n[3]: https://libcxx.llvm.org\n[4]: https://kuanweeloong.github.io/BareMetalLib\n[5]: https://llvm.org/foundation/relicensing/LICENSE.txt\n[6]: https://creativecommons.org/licenses/by-sa/4.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuanweeloong%2FBareMetalLib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkuanweeloong%2FBareMetalLib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkuanweeloong%2FBareMetalLib/lists"}