Quantcast
Channel: lkml.org : Shesha Sreenivasamurthy
Viewing all articles
Browse latest Browse all 1267

Re: [PATCH v3] kernel.h: Skip single-eval logic on literals in min ...

$
0
0
Linus Torvalds writes: (Summary) So in *historical* context - when a compiler didn't do variable length arrays at all - the original semantics of C "constant expressions" actually make a ton of sense.
actually make a ton of sense.
You can basically think of a constant expression as something that can be (historically) handled by the front-end without any real complexity, and no optimization phases - just evaluating a simple parse tree with purely compile-time constants.
parse tree with purely compile-time constants.
So there's a good and perfectly valid reason for why C limits certain expressions to just a very particular subset. And those are very much part of the C standard.
the C standard.
So an error message like
So an error message like
warning: ISO C90 requires array sizes to be constant-expressions warning: ISO C90 requires array sizes to be constant-expressions would be technically correct and useful from a portability angle.

Viewing all articles
Browse latest Browse all 1267

Trending Articles