C23 Standard is Coming: Lock Your Thread

A major revision of the C language standard is due out this year, report Terence Kelly and Borer Yekai Pan, and the changes are such that “programmers should not ‘upgrade’ without carefully weighing risks against benefits,” they note.

The latest standard (C23) introduces several useful features that “make it easier to write safe, correct, and secure code.” However, the authors warn:

“C23 actually expands one of C's most notorious traps for the unwary. All C standards from C89 onward have permitted compilers to delete code paths containing undefined operations — which compilers merrily do, much to the surprise and outrage of coders. C23 introduces a new mechanism for astonishing elision: By marking a code path with the new unreachable annotation, the programmer assures the compiler that control will never reach it and thereby explicitly invites the compiler to elide the marked path.”

This detailed article covers “the highs and lows of the latest draft” and discusses ways to avoid pitfalls. Go for the lesson in C idioms and stay for the song parody. 

Read the full article at ACM Queue.

Ready to find a job?
Sign up for job alerts and check out the latest listings at Open Source JobHub.

FOSSlife Newsetter

Comments