km!1000
for 1000 kilometers. Here, km is a template that takes an integer argument: struct Kilometer { int v; }
template km(int V) { Kilometer km = Kilometer(V); }[1] https://en.cppreference.com/w/cpp/language/user_literal
[2] https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2013/n34...
Still, I have rarely seen C++ compilers for embedded systems. Although the latter definition more and more includes PC hardware.
What kind of embedded systems? Even AVR has a C++ compiler.
Yes, AVR has a C++ compiler, but I could imagine it doesn't support all language features. If it does it would still be discouraged to use dynamic memory allocation, which is pretty essential to leverage many advantages of object orientated languages.
Of course embedded systems aren't restricted to that anymore and you are perfectly fine to use C++ for the average ARM system that isn't as restricted memory wise.
0b1111_1111
0b11111111u8
0b1111_1111_u8
0b11_11_11_11_u8
https://doc.rust-lang.org/book/ch03-02-data-types.htmlBut oh how I hate `. I had to edit my layout to make it typable for stupid haskell infix functions
In D, you would have:
ubyte b = 0b1111_1111;