SQLite Forum

Why coding for all versions of C is hard
Login

Why coding for all versions of C is hard

(1) By Simon Slavin (slavin) on 2022-01-21 19:14:47 [source]

Those of you interested only in practical use and problems with SQLite please excuse me, and skip this post.

An interesting paper on ISO C was made available today:

https://arxiv.org/abs/2201.07845

How ISO C became unusable for operating systems development

Click 'PDF' link top right for the actual paper with no registration and no paywall.

Though the paper wasn't written with this in mind, it describes in detail how differences in C compiler strategies can lead to serious problems in resulting code. It relates to numerous posts on this forum complaining "My compiler generates warnings/errors when compiling SQLite." or "Your code fails static analysis because it misuses pointers.".

It's especially fun reading Dennis Ritchie criticising drafts of proposed C 'improvements'.

I was amused to notice that C documentation sets the tone for SQLite documentation. Not only are certain things undefined, but certain things are specifically declared as undefined, and implementations of C are required not to define them.