RSSAmplifier

Blog

Jens Gustedt's Blog

programming in modern C

gustedt.wordpress.comRSS feed ↗10 posts

Latest posts

Defer available in gcc and clang

About a year ago I posted about defer and that it would be available for everyone using gcc and/or clang soon. So it is probably time for an update. Two things have happened in the mean time: I have not yet got my hands on the gcc implementation (but this is also less urgent, see [ ]

Alias and references as localized macros

Since the last meeting of the C committee I am struggling with the idea of aliases as they are proposed in a long series of papers by JeanHeyd. Transparent Aliases I am struggling with this for several reasons, but most importantly is that I have the impression that it is a heavy gun pointed on [ ]

Modern C, C23 edition, now in print

At last, the new edition is now also available in print and e-pub versions, the contents is the same as described in the previous article. Find all the details at https://gustedt.gitlabpages.inria.fr/modern-c/

The provenance memory model for C

[The wordpress markdown inclusion does a very bad job, it seems, there have been some idiotic formatting errors. I hope that these are fixed, now.]

Make C string literals const?

Martin Uecker has started a new initiative to ensure a better const contract for C2y: change the type of string literals to a const-qualified base type, much as it is already the case in C++. Compilers support this since a very long time; some of them have this as default, some provide command line switches [ ]

A diagram of C23 basic types

This week on the C committee mailing list we had a discussion about how C s types are organized into different categories. At the end I came up with a diagram with that organization. It basically translates the section 6.2.5 Types of the C23 standard into a graph of inclusions. Sorry, it is probably a little [ ]

Contracts for C

C++ seems to finally converge with their contracts proposal, https://wg21.link/p2900. I decided to give it a try and come up with ideas how such a thing would look for C. This is in early stages, not a full proposal yet, and still would need implementation by some of the major compilers. In particular, the C++ [ ]

Preprocessor meta-quotes with eĿlipsis

The new revision of eĿlipsis (20250219) has a lot of cleanups, bugfixes etc, but one thing I d like to emphasize is a new feature that I d call meta-quotes in lack for a better idea of a name that implement exemption of tokens from macro replacement. So in C that would interact with translation phase 4. [ ]

Simple defer, ready to use

With this post I will concentrate on the here and now: how to use C's future lifesaving defer feature with existing tools and compilers.

The C23 edition of Modern C

The C23 edition of Modern C is now available for free download from https://hal.inria.fr/hal-02383654 And as before a dedicated page for the book may be found at https://gustedt.gitlabpages.inria.fr/modern-c/ where you also may find a link to download the code examples that come with the book.