News for hackers. Stuff that matters.
Re:My personal C coding style as of late 2023 by dundarious on Sunday October 08, 2023 @10:16PM (#37816276)
> > I’ll cast away the const if needed.

> Undefined behavior[2]

To be clear, it's only UB if the object was defined const, which is the case given he wrote:

> One small exception: I still like it as a hint to place static tables in read-only memory closer to the code. I’ll cast away the const if needed.

So you are correct on this point. Funnily enough, such objects are relatively rare IME, so I had to double-check to see that he was advocating it in the rare case where it must not be applied.

There are no comments on this comment yet.