Live data from Hacker News

Tell HN: C Experts Panel – Ask us anything about C

news.ycombinator.com

581–590 of 978 posts

Re: Tell HN: C Experts Panel – Ask us anything about C

#581

Earlier quoted context omitted.

Should take Verilog binary construction syntax, like { 12'd12, 16'hffee, 3'b101 } (or something similar that would fit with C's syntax).

Maybe not.

Why not? If you have to combine bit fields now, it's a mess of shifting and masking.

Re: Tell HN: C Experts Panel – Ask us anything about C

#582
post #556

Earlier quoted context omitted.

Several of us discussed typeof and I'd expect a proposal for a feature along these lines to be well received. (I recall someone even saying they're working on one but that shouldn't stop anyone from submitting one of their own.)

I'm glad to hear that. What about statement expressions? They're quite useful, and supported by multiple independent compilers.

I'm not aware of recent proposals for those but we have discussed ideas along those lines (closures: N2030, C++ lambdas, Apple Blocks: N1451, and I think there was one from Cilk). I think there was interest but not enough support for the details and likely also concerns from implementers.

Re: Tell HN: C Experts Panel – Ask us anything about C

#583

1. How likely are named constants of any types to be included in C2x? I'm referring to the idea of making register const values be usable in constant expressions. 2. Is there, or was there ever a proposal to make struct types without a tag be structurally typed? This would not break backwards compatibility as far as I can see, and would make these types much more useful as ad-hoc bags of data. Small example: struct {…

3. would have to be a new mechanism for variadic functions, that would have to be distinguished in header files from the old mechanism with which it is incompatible. So this proposal would imply some new keyword or syntax. I am not in the committee, but I don't think this is going to happen. The improvement is way too incremental to force a new syntax.

(The committee is fine with incremental improvements, but new syntax need to have strong motivation behind it, much stronger than this.)

Re: Tell HN: C Experts Panel – Ask us anything about C

#584
post #97

A lot of you seem to be working on commercial solutions to C's insecurity. Does this feel like a conflict of interest to you?

Good question, but not at all! I've been working as hard as I can for the past 15 years to improve C Language security as have other security-minded members of the committee. Generally speaking, we are in the minority as performance is still the major driver for the language. Any security solution that introduces > 5% overhead, for example, is a nonstarter. I think we all understand that are jobs are completely safe…

I guess this is why vendors like Apple, Oracle, ARM and Google end up going the hardware memory tagging route instead.

Re: Tell HN: C Experts Panel – Ask us anything about C

#585
post #511

Would you consider adding a built-in way to safely multiply two numbers? Numeric overflows in things like calculation of buffer sizes can lead to vulnerabilities. Signed overflow is UB, and due to integer promotion signs creep in unexpected places. It's not trivial to check if overflow happened due to UB rules. A naive check can make things even worse by "proving" the opposite to the optimizer. And all of that is to…

There are a lot of arithmetic conditions for which C could generate special code. There are div_t-related functions for the other direction. I for one would like a good way to obtain, using some Standard C coding pattern, fast "carry" for multiple-precision integer arithmetic.

Several places in support functions, I have coded unusually to avoid wrap-around etc. I bet you could devise something like that for (unsigned) multiplication.

Re: Tell HN: C Experts Panel – Ask us anything about C

#586
post #15

When you're looking at an unfamiliar C code base for the first time, how do you approach it? Which files do you look for? Which tools to you open up immediately?

cscope can help

Yes, I have found it helpful. One nice feature is that it uses a character-terminal interface, not a platform-specific GUI.

Re: Tell HN: C Experts Panel – Ask us anything about C

#587

Curious what the committee members think of the new competitors to C, e.g. Go, Rust, and Zig. Any comments?

go isnt a competitor to c

F-Secure apparently thinks otherwise,

https://www.f-secure.com/en/consulting/foundry/usb-armory

As does Google,

https://github.com/google/gvisor

https://github.com/google/gapid

Naturally if one is talking about specific uses cases like IoT with a couple of KBs, MISRA-C, or UNIX kernels, then yes Go is not a competitor.

Re: Tell HN: C Experts Panel – Ask us anything about C

#589

To what extent does compiler complexity factor into your thinking about the evolution of C? Thanks for this!

When the committee considers proposals, we do consider the implementation burden of the proposal as part of the feature. If parts of the proposal would be an undue burden for an implementation, the committee may request modifications to the proposal, or justification as to why the burden is necessary.

Thanks. Do you have an example of a proposal that the committee considered an undue burden for an implementation but was otherwise sound?
Post reply on HN