Get the latest tech news

Maximal min() and max()


[LWN subscriber-only content] Like many projects written in C, the kernel makes extensive use of the C preprocessor; indeed, the kernel's use is rather more extensive than most. The preprocessor famously has a number of sharp edges associated with it.

The goal was to increase correctness, but the immediate effect was to break compilation throughout the kernel; the result was a classic linux-kernel flame war of the type that, fortunately, tends not to happen anymore. Even if one expects a large expansion, though, the actual amount may lead to significant eyebrow elevation: the single line of code shown above expands to 47MB of preprocessor output. He converted a number of the worst expansion cases to use the new macros just prior to the 6.11-rc1 release, then merged a patch taking away the ability for min() and max() to work as part of a constant expression.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of Max

Max

Photo of Maximal Min

Maximal Min

Related news:

News photo

Max’s new homepage personalization tech makes viewers stick around, says exec

News photo

Lawyers for families of passengers killed in 737 Max crashes ask court to block Boeing plea deal

News photo

There's another new streaming deal, but this time the bundle includes Hulu, Disney Plus, AND Max