MariaDB is primarily written in C++. — or are we? Hah, you will be surprised with how little C++ features we use.
| extends Timer | |
| func await_await() -> Signal: | |
| print("await signal") | |
| await timeout | |
| print("await return") | |
| return timeout | |
| func _enter_tree() -> void: | |
| print("await start") |
Here, I will call the currently-checked-out (HEAD) local branch as simply the current branch.
If the repo is omitted, git push searches the following configs and uses the first one configured:
branch.<current branch>.pushRemoteremote.pushDefaultbranch.<current branch>.remote
Today, I realized that != and <> can be different.
Of course, they are equivalent in the ideal domain, but we live in a polymorphic world where two values can be incomparable with each other.
For example, 1, a number, is incomparable to "Hello", a string of text.
This relation is mathematically known as a Partial Ordering.
Arguably, "Hello" doesn’t literally equal one, which we can denote as "Hello" ≠ 1.
On the other hand, "Hello" ≶ 1 doesn’t quite hold.
Their mutual incomparability means that neither is less or greather than the other; it would instead be "Hello" ≸ 1.
| # Basics | |
| module Container[V, E = V]: _Container[V, E] | |
| include Enumerable[E] | |
| interface _Container[V, E = V] | |
| def self.from: (Enumerable[E] other) -> instance | |
| def include?: (V value) -> bool | |
| def add?: (E entry) -> E? |
| #include <cstdint> | |
| #include <tuple> | |
| #include <type_traits> | |
| #include <iostream> | |
| using std::size_t; | |
| /** Compile-time Fixed-Size Array of Types */ | |
| template<typename... T> struct TypeArray { | |
| using TupleType = std::tuple<T...>; | |
| template<size_t i> using At = |
| #include <stddef.h> | |
| #include <stdint.h> | |
| /** | |
| Here is my Standard-compliant, SIMD-capable version of | |
| https://pzemtsov.github.io/2016/11/06/bug-story-alignment-on-x86.html. | |
| I wonder which one is faster in a benchmark? | |
| */ | |
| _Bool check_ip_header_sum(const char *p, size_t size) | |
| { |
| #include <optional> | |
| #include <cstdio> | |
| int main() { | |
| std::optional<int> optional_of_none(std::nullopt); | |
| std::optional<std::optional<int>> optional_of_optional(optional_of_none); | |
| std::printf( | |
| "optional_of_none.has_value():\t%d\n" | |
| "optional_of_optional.has_value():\t%d\n", |
| puts$*[0].gsub(/(.)\1*/){'_🌷🌼🪻'[it.size]+$1} |
| // Lambda is a type of *value*, and *values* can’t be null. | |
| // But y’know what can? *References* to values. | |
| #include <functional> | |
| #include <stdio.h> | |
| const auto lambda = [] () -> const char* { | |
| return "Hello from lambda!"; | |
| }; |