June 4th, 2021

Decent concepts

No Comments, Gramada, by admin.

Last year I published two posts on writing concepts: Concept Archetypes, Semantic requirements in concepts. Having had some time to reflect upon these posts, I now realize that the model presented in them is not complete. In this post I … Continue reading Read the rest

December 10th, 2020

Memory Allocation in Rust

No Comments, Gramada, by admin.

I am porting a project from C to Rust. The C project manages all memory allocation using chunk allocators. All memory is freed at the end. Another property of the implementation is that a memory reference to an object is never reused or changed, so that any code that is using the reference doesn’t need to worry that the object they refer to will be somehow deleted and the reference will become invalid.

When porting to Rust, I had to … Read the rest

In this post we will see what a contract is, how preconditions and invariants can be derived from the contract, and how this process can help detect bugs. Two points that I will be stressing in this post are: (1) … Continue reading Read the rest

December 7th, 2020

Beginning Rust

No Comments, Gramada, by admin.

I am translating one of my projects to Rust as a way of learning Rust. To make things more interesting, I am trying to implement my own memory allocators and data structures. After all, in C or C++ that is something I can do easily, so it is worthwhile figuring out how much effort this will be in Rust.

Here is my first piece of code. Lets first look at the C version and then at my attempt to do … Read the rest

December 7th, 2020

C Enum equivalent in Rust

No Comments, Gramada, by admin.

In C code we often use enums to represent constants like so:


enum TokenType {
TOK_OFS = 256,
TOK_and,
TOK_break,
TOK_STRING,

FIRST_RESERVED = TOK_OFS + 1,
LAST_RESERVED = TOK_while - TOK_OFS
};

Rust also has an enum type but it is not at all like the C enum. The Rust enum is more like a discriminated union in C.

Superficially though you can almost write something like above in Rust.


enum TokenType {
TOK_OFS = 256,
TOK_and,
TOK_break,
TOK_STRING,

FIRST_RESERVED
Read the rest

October 27th, 2020

Semantic requirements in concepts

No Comments, Gramada, by admin.

The word ‘concept’ in the context of C++ generic programming has two meanings. The first is more abstract: it is the notion from the domain of Generic Programming (GP) in general. GP is not tied to any specific language: it … Continue reading Read the rest

October 1st, 2020

Reflection for aggregates

No Comments, Gramada, by admin.

An aggregate is an array or a class with no user-declared or inherited constructors, no private or protected direct non-static data members, no virtual functions, and no virtual, private, or protected base classes. Aggregates can be initialized in aggregate initialization, … Continue reading Read the rest

September 11th, 2020

Concept archetypes — update

No Comments, Gramada, by admin.

An observant reader indicated that in the previous post where I was trying to implement a concept archetype — a type with minimal interface that models a given concept — I actually failed. This deserves a closer examination. Let’s recall. … Continue reading Read the rest

September 3rd, 2020

Concept archetypes

No Comments, Gramada, by admin.

Concepts in the form added in C++20 used to be called lite. This is because they do not provide one quite important functionality: having the compiler check if the author of a constrained template is only using operations and types … Continue reading Read the rest


We’ve given this professional training to dozens of international and national disaster management organizations during the past half-decade. We’ve also run this training for both new and highly experienced drone pilots in dozens of countries around the world. The purpose of this training is to make you an effective and responsible team leader when deploying drones in disaster response. This training is also a great fit if you’re simply curious to learn more about the latest on the use of
Read the rest