Lurker News
Hi HN,

We are members of the C Standard Committee and associated C experts, who have collaborated on a new book called Effective C, which was discussed recently here: https://news.ycombinator.com/item?id=22716068. After that thread, dang invited me to do an AMA and I invited my colleagues so we upgraded it to an AUA. Ask us about C programming, the C Standard or C standardization, undefined Behavior, and anything C-related!
The book is still forthcoming, but it's available for pre-order and early access from No Starch Press: https://nostarch.com/Effective_C.
Here's who we are:
rseacord - Robert C. Seacord is a Technical Director at NCC Group, and author of the new book by No Starch Press “Effective C: An Introduction to Professional C Programming” and C Standards Committee (WG14) Expert.
AaronBallman - Aaron Ballman is a compiler frontend engineer for GrammaTech, Inc. and works primarily on the static analysis tool, CodeSonar. He is also a frontend maintainer for Clang, a popular open source compiler for C, C++, and other languages. Aaron is an expert for the JTC1/SC22/WG14 C programming language and JTC1/SC22/WG21 C++ programming language standards committees and is a chapter author for Effective C.
msebor - Martin Sebor is Principal Engineer at Red Hat and expert for the JTC1/SC22/WG14 C programming language and JTC1/SC22/WG21 C++ programming language standards committees and the official Technical Reviewer for Effective C.
DougGwyn - Douglas Gwyn is Emeritus at US Army Research Laboratory and Member Emeritus for the JTC1/SC22/WG14 C programming language and a major contributor to Effective C.
pascal_cuoq - Pascal Cuoq is the Chief Scientist at TrustInSoft and co-inventor of the Frama-C technology. Pascal was a reviewer for Effective C and author of a foreword part.
NickDunn - Nick Dunn is a Principal Security Consultant at NCC Group, ethical hacker, software security tester, code reviewer, and major contributor to Effective C.
Fire away with your questions and comments about C!

Comments (962) 182 threads

Earlier comments
Koshkin1 reply#
Why not keep C a simple little language with fast compile times and delegate all "enhancements" (such as 'cleanup') to C++?
lioeters#
From reading all their comments up to now, my feeling is that's exactly their plan.

When asked, "Where do you think C is going?", one of them said, "I don't see it going anywhere." I took that as a good thing, meaning, they're concerned about backward compatibility, compiler performance, and only adding features when there's a wide concensus in implementation - which is a high enough hurdle that avoids the feature bloat of C++.
Overall, I felt the "conservatism" refreshing, to keep the language small.
On the other hand, there are several common feature requests I see in this thread that probably will never be part of the language, since it moves slow relative to other languages.

polishdude201 reply#
What is your favorite language other than C and why?
smlckz1 reply#
another proposal:

    _If, _Ifdef, _Ifndef
inside function macros

for example:

    #ifdef SOME_CONST
    #define WHATEVER(w, h, a, t, e, v, e, r) \
        ... common part ... \
        ... for SOME_CONST ... \
        ... common part continued ...
    #else
    #define WHATEVER(w, h, a, t, e, v, e, r) \
        ... common part ... \
        ... when SOME_CONST not defined ... \
        ... common part continued ...
    #endif
With _Ifdef, the above could be written like:

    #define WHATEVER(w, h, a, t, e, v, e, r) \
    ... common part ... \
    _Ifdef(SOME_CONST, \
        (... for SOME_CONST ...) , \
        (... when SOME_CONST is not defined ...)
    ) \
    ... common part continued ...
With these, one could also do:

    #define FACTORIAL(n) _If(n == 0, 1, (n) * FACTORIAL(n))
    int f = FACTORIAL(6);
turns into: int f = (6) * (5) * (4) * (3) * (2) * (1) * 1;

That would be very useful, I think. It might help with code duplication in function macros.
Maybe _Switch/_Case thereafter.

clktmr#
Why not write is like this:

    #ifdef SOME_CONST
    #define HAS_SOME_CONST \
        ... for SOME_CONST ...
    #else
    #define HAS_SOME_CONST \
        ... when SOME_CONST not defined ...
    #endif

    #define WHATEVER(w, h, a, t, e, v, e, r) \
        ... common part ... \
        ... HAS_SOME_CONST ... \
        ... common part continued ...
rs23296008n1#
Modern C language features:

- Why no sized text strings?
- Why is there no hash data type?
- Where's the linked list?
- Why no package management as part of ecosystem?
What is the modern rationale?
Caveats:
- I'm not implying any need for object-orientation (OOP)
- I'm fully aware I can write these myself and can access third party libraries that have each laboriously implemented their own versions.
- I'm interested in why these are not native C constructs in 2020. I appreciate why not in 1980.

Load more comments