Re: Plz explain me the following code
- From: Kenneth Brody <kenbrody@xxxxxxxxxxx>
- Date: Fri, 25 Sep 2009 11:22:48 -0400
jameskuyper wrote:
[...]
The modification I'm talking about is the one Kenneth Brody suggested
in his message with the header "Date:Thu, 24 Sep 2009 13:17:54 -0400":
Perhaps replacing UB with something like "anything left undefined will, on
hosted implementations, behave in a manner consistent with the host"? So,
dereferencing a NULL pointer on Unix can't launch nuclear missiles, since
Unix says it should SEGV.
Basically, "I am not imposing any restrictions, but I do require that you
follow the restrictions placed on you by the host platform".
The essence of what I'm saying is that this modification is poorly
specified. I don't see any good way to improve it, either, or I would
have suggested one.
Note that I wasn't actually proposing a well-thought-out idea for an actual change to C. It was mostly an off-the-cuff reply to a thread which had started going towards "why does C even allow UB ... UB == bad language design".
And, thinking a little more about it, some UB doesn't even involve the host. For example, fclose() on an invalid FILE*, or free() with a pointer not from malloc() and friends. (Yes, the host may get involved if the pointer itself is not valid, but what happens with a valid pointer but just not pointing to what is expected?)
Of course, it's always interesting what discussions ensue from such posts.
--
Kenneth Brody
.
- Follow-Ups:
- Re: Plz explain me the following code
- From: Phil Carmody
- Re: Plz explain me the following code
- References:
- Plz explain me the following code
- From: manish sahu
- Re: Plz explain me the following code
- From: Keith Thompson
- Re: Plz explain me the following code
- From: Kenny McCormack
- Re: Plz explain me the following code
- From: Seebs
- Re: Plz explain me the following code
- From: Kenny McCormack
- Re: Plz explain me the following code
- From: Seebs
- Re: Plz explain me the following code
- From: Kenneth Brody
- Re: Plz explain me the following code
- From: Seebs
- Re: Plz explain me the following code
- From: Kenneth Brody
- Re: Plz explain me the following code
- From: jameskuyper
- Re: Plz explain me the following code
- From: Kenneth Brody
- Re: Plz explain me the following code
- From: jameskuyper
- Re: Plz explain me the following code
- From: Keith Thompson
- Re: Plz explain me the following code
- From: jameskuyper
- Re: Plz explain me the following code
- From: Keith Thompson
- Re: Plz explain me the following code
- From: jameskuyper
- Plz explain me the following code
- Prev by Date: Re: ANN An ansic90 version of lcc-win
- Next by Date: Re: Darn default-int (minor vent)
- Previous by thread: Re: Plz explain me the following code
- Next by thread: Re: Plz explain me the following code
- Index(es):
Relevant Pages
|