news.volyx.in

Some Obscure C Features (multun.net)

476 points by Morhaus · 2614 days ago · 138 comments on HN

Article summary

The article discusses several obscure features of the C programming language, including features introduced in C99. These features include sizeof having side effects, compatible function declarations, and compile-time tree structures. The article also mentions other lesser-known features such as array designators, the preprocessor being a functional language, and Duff's devices. These features are not well-known among C programmers and can be useful in certain situations.

Main themes

  • obscure C features
  • C99 features
  • preprocessor functionality
  • array designators
  • Duff's devices

What commenters say

  • Some of the listed features are not as obscure as claimed, and are actually well-known and commonly used in certain contexts. The preprocessor's ability to pass macros as parameters is a useful feature that has been used in various projects. The use of certain features, such as variable-length arrays, can be problematic and is avoided in some projects. The distinction between C and C++ is highlighted by differences in their treatment of character constants and scoping rules. Lexical scoping is a common feature in many programming languages, and its use in C and C++ is not unique. The use of macros and the preprocessor can be powerful, but also error-prone and difficult to debug. Some commenters disagree on what constitutes an 'obscure' feature, with some arguing that a feature's usefulness or commonality is not necessarily tied to its obscurity.