News for hackers. Stuff that matters.
Re:A Provenance-aware Memory Object Model for C [pdf] by rualca on Saturday June 19, 2021 @07:48AM (#27559708)
> I don't think the world has a need for faster c code. But is in dire need for less broken software. This is trying to do the opposite.

And that's ok. There are tools for that at the reach of those who place a premium on those requirements.

For those who favour interoperability, simpler mental models, efficiency, and more importantly a tool with a proved track record, there's C.

And there are plenty of reasons why C is the de facto standard in spite of all alternatives.

Re:A Provenance-aware Memory Object Model for C [pdf] by dooglius on Saturday June 19, 2021 @07:58AM (#27559753)
Are you genuinely claiming that this makes for a SIMPLER mental model (as compared to the implicit "concrete" model)? I don't see how you can justify that...
Re:A Provenance-aware Memory Object Model for C [pdf] by keithalewis on Saturday June 19, 2021 @08:39AM (#27559952)
If you are trying to mentally model how the keys you are pressing will be turned into the machine instructions that will ultimately get executed, yes. But that is no excuse for not looking at assembly.
Re:A Provenance-aware Memory Object Model for C [pdf] by Blaisorblade0 on Saturday June 19, 2021 @08:48AM (#27560008)
But you can’t compare to the concrete model, because it’s not the status quo. That ship already sailed with C89 and strict aliasing. Ptr2int casts were never legal, and support was inconsistent.

For instance, GCC sometimes tracks pointer provenance through integers; this proposed change will make that clearly illegal.

Re:A Provenance-aware Memory Object Model for C [pdf] by dooglius on Saturday June 19, 2021 @09:06AM (#27560142)
The concrete model was raised explicitly as a possible option, why can't I compare to that? TFA says that the status quo is ambiguous.

>Ptr2int casts were never legal

Citation on this? The existence of uintptr_t seems to say otherwise.

>That ship already sailed

In principle, I see no reason preventing future versions of the standard from defining previously-undefined behavior. That said, you are probably right in a realpolitik sense.

Re:A Provenance-aware Memory Object Model for C [pdf] by Blaisorblade0 on Saturday June 19, 2021 @09:22AM (#27560235)
Should have been more careful — in C and C++ they were implementation-defined. But both theory and practice did not mandate a concrete model — GCC already violates that and implements a mishmash of PVI and PNVI.

From N2176, Sec. 6.3.2.3, p. 5-6: > An integer may be converted to any pointer type. Except as previously specified, the result is implementation-defined, might not be correctly aligned, might not point to an entity of the referenced type, and might be a trap representation.

> Any pointer type may be converted to an integer type. Except as previously specified, the result is implementation-defined. If the result cannot be represented in the integer type, the behavior is undefined. The result need not be in the range of values of any integer type.

AFAICT, that doesn’t even guarantee that a roundtrip is the identity — which C++ mandates and is still the case: http://eel.is/c++draft/expr.reinterpret.cast#5

EDIT: GCC does have those restrictions in place already: https://gcc.gnu.org/onlinedocs/gcc-11.1.0/gcc/Arrays-and-poi...

and since a while (earliest relevant docs I could find easily): https://gcc.gnu.org/onlinedocs/gcc-3.1.1/gcc/Arrays-and-poin...

EDIT2: LLVM doesn’t document this “implementation-defined behavior” (or most others), even if docs are explicitly required by the standard; but it does use pointer provenance in practice already, but not in a way that’s easy to explain.

Re:A Provenance-aware Memory Object Model for C [pdf] by pjmlp on Saturday June 19, 2021 @08:49AM (#27560017)
UNIX and C being available as free beer since their inception (actually 6th edition) kind of outnumbers all the other possible reasons.
Re:A Provenance-aware Memory Object Model for C [pdf] by rualca on Saturday June 19, 2021 @01:28PM (#27562430)
> UNIX and C being available as free beer since their inception (actually 6th edition) kind of outnumbers all the other possible reasons.

That would only explain why C featured as one of the choices on the table.

But from that point on, people like you and me made conscious decisions based on their requirements and preferences, and C frequently was everyone's top choice.

Re:A Provenance-aware Memory Object Model for C [pdf] by pjmlp on Saturday June 19, 2021 @01:45PM (#27562578)
Just like JavaScript is frequently everyone's top choice for the browser, and PHP is frequently everyone's top choice for making their websites dynamic in most ISPs.

Quality is surely not the common factor to all those top choices, rather being the platform owners, with all that it entails to the surrounding ecosystem.

Re:A Provenance-aware Memory Object Model for C [pdf] by rualca on Saturday June 19, 2021 @02:58PM (#27563310)
> Just like JavaScript is frequently everyone's top choice for the browser

No, not really, and frankly this feels like a disingenuous comparison done in bad faith. I'm sure you know that, unlike C, javascript is pretty much the only option on the table if your goal is to produce anything remotely resembling production code. Also, as you certainly are aware, that's far from the case with C. In fact, you should certainly be aware that one of the most popular compiler toolkits there is, and one which has been the de facto standard for a few decades now, offers C only as a front-end, on par with languages such as Ada, which already was around for close to a decade before C's first international standard was published.

Thus, you'll need to come up with an explanation of why people repeatedly pick C over well established languages explicitly designed to meet he requirements you favour, and one which is already around for four decades, and is already standard and widely available and enjoys some adoption in some fields. But in spite of it everyone still picks C over it.

Re:A Provenance-aware Memory Object Model for C [pdf] by pjmlp on Sunday June 20, 2021 @03:18AM (#27567886)
C is the only option in UNIX/POSIX platforms like 99% of the time.

The other being C++, which happens to be for better or worse, almost copy-paste compatible with C89, also also a UNIX child born a couple of offices down the corridor.

Interesting that you pick Ada, given how outrageous the compilers used to cost, versus the freebie C compiler that already came on the box, and cleverly washout the complaints on the FOOS community that won't touch GNAT due to licensing FUD.

Who is on bad faith here?

Re:A Provenance-aware Memory Object Model for C [pdf] by johnthescott on Saturday June 19, 2021 @04:41PM (#27564279)
bravo.
Re:A Provenance-aware Memory Object Model for C [pdf] by 1ris on Saturday June 19, 2021 @08:31AM (#27559905)
I don't get what you are trying to tell me. People use C. Yes, it get it. I actually argued infafour of that. Embedded development, device drivers and kernels.

None of these need speed. They need reliability and maintainability. The standards committee is prying the language out of the hands of these people. Because they need, using your words, "interoperability, simpler mental models," which is sabotaged by efforts like this one.