What is Expressiveness in a Computer Language [off-topic]

Matthias Blume find at my.address.elsewhere
Mon Jun 26 11:17:39 EDT 2006


David Hopwood <david.nospam.hopwood at blueyonder.co.uk> writes:

> Matthias Blume wrote:
>> I agree with Bob Harper about safety being language-specific and all
>> that.  But, with all due respect, I think his characterization of C is
>> not accurate.
> [...]
>> AFAIC, C is C-unsafe by Bob's reasoning.
>
> Agreed.
>
>> Of course, C can be made safe quite easily:
>> 
>> Define a state "undefined" that is considered "safe" and add a
>> transition to "undefined" wherever necessary.
>
> I wouldn't say that was "quite easy" at all.
>
> C99 4 #2:
> # If a "shall" or "shall not" requirement that appears outside of a constraint
> # is violated, the behavior is undefined. Undefined behavior is otherwise
> # indicated in this International Standard by the words "undefined behavior"
> # *or by the omission of any explicit definition of behavior*. [...]
>
> In other words, to fix C to be a safe language (compatible with Standard C89
> or C99), you first have to resolve all the ambiguities in the standard where
> the behaviour is *implicitly* undefined. There are a lot of them.

Yes, if you want to make the transition system completely explict, it
won't be easy. I was thinking of a catch-all rule that says:
transition to "undefined" unless specified otherwise.  (Note that I am
not actually advocating this approach to making a language "safe".
For practical purposes, C is unsafe.  (And so is C++.))



More information about the Python-list mailing list