One of the many innovations in C++11 was static_assert. This allowed, at long last, a custom error message at compile time. Sure, we’ve had the #error directive for a while, but that only works for conditions that one could evaluate…
No time, no problem
Unit tests are supposed to be deterministic. If a test is called out as being nondeterministic, you can bet that it depends on time in some way. Any app big enough and with sufficient unit tests likely has something akin…
UberQueue challenge
David Fowler tweeted: Coding challenge for you in any language. I want to see different ways of expressing this computation: The challenge was, of course, expressed in C# and what luck — that was my chosen implementation language! Before I…
Letter Boxed: Rust impl, part 4 (complete solver)
After some incremental progress in our Letter Boxed solver, we’re now ready to complete the app. Our hard-won “expertise” in Rust now makes the last several steps largely mechanical. The first set of changes produces LetterBox and Vertices structs, so…
Letter Boxed: Rust impl, part 3 (modules, trie, I/O)
Our Rust-based Letter Boxed code so far has just the core character-based data types. Today we’ll add the trie. Before we move on, we need to keep our house in order. Rather than have one massive lib.rs file, we should…
Letter Boxed: Rust impl, part 2 (panicking, hashing, parsing)
Previously we began our Rust exploration of Letter Boxed with the core St and Ch structs. Now we’ll complete their functionality. The next test on our TODO list looks like this in the C# version: We’ve already encountered our first…
Letter Boxed: Rust impl, part 1 (basics)
We’ve already set up the development environment, so let’s write some Rust code! A good place to start is with the bottom layer data structures, known as Str and Ch in the C# version. To review, Ch is an enumeration…
Cross-platform without complexity: .NET interop
The cross-platform project has a shared library now. Wouldn’t it be fun to try to build an interop project using P/Invoke with this library? To account for the addition of .NET projects, we’ll need to revisit the project structure: inc…
Cross-platform without complexity: VS IDE
Let’s say you want to start a modern C++ project. However, you have some requirements in mind that may be hard to achieve. First, the project should support development in the Visual Studio IDE but also provide a simple command…
Watching a directory: debouncing
Over the last few posts, we have created a relatively full-featured DirectoryWatcher library, but it has one glaring omission. To demonstrate, let’s review the output of the sample program which randomly modifies the files it is watching: For many types…