← Back to context

Comment by gspr

1 month ago

Could you please explain why you feel that having UB makes C less precise than asm?

To me, the notion of precision isn't in any way related to whether any given statement is sound. It's about the behavior of the language for sound programs.

There are syntactically well-formed C programs that are not sound programs because their behavior is undefined. Or, rephrasing: a subset of all parseable C programs contain 'do whatever, I dunno'. I interpret this as a lack of precision.

One could take the position that specifying precisely 'do whatever, I dunno' counts as perfectly precise. But then a language that was entirely UB would count as precise, which would be an odd position to hold, since you can't specify any behavior at all with it.

  • Nobody seriously interprets "the C programming language" as "parseable C". Of course there's parseable, undefined C, and of course it's very imprecise. It's not relevant.

    Now consider sound, in-spec C. Versus natural language.

    • Ok I’ll do the same move and show why it doesn’t persuade me.

      Consider the subset of natural language that has strictly defined semantics. This would include, for example, talking in about the arithmetic of real numbers. The rest is not relevant to evaluating the precision of natural language.

      Does that exclusion feel different in the natural language case? Why?

      Perhaps it’s a matter of degree, not a categorical difference.

      1 reply →