Re: casting
- From: jaysome <jaysome@xxxxxxxxxxx>
- Date: Sat, 10 Jun 2006 01:12:46 -0700
On Fri, 09 Jun 2006 23:45:28 -0400, CBFalconer <cbfalconer@xxxxxxxxx>
wrote:
Keith Thompson wrote:
CBFalconer <cbfalconer@xxxxxxxxx> writes:
[...]
Trying to stuff a value into a signed object that cannot hold that
value results in implementation defined behaviour. You could have
just set off that 3 tons of fertilizer they found in Canada. Only
stuffing into unsigned objects has a defined action.
On a conversion to a signed integer type, if the value cannot be
represented, "either the result is implementation-defined or an
implementation-defined signal is raised". There is no undefined
behavior.
Doesn't the phrase "implementation defined behaviour" mean just
that? To me, that includes signalling or peculiar result values.
So what you're saying is that the consequences of "implementation
defined behaviour" could be the same as the consequences of "undefined
behaviour"?
If that were the case, and I'm not saying that it is or isn't,
shouldn't we expect some hard-core pedantics to start telling us that
use of "implementation defined behaviou" could lead to formatting of
our hard drives?
Personally, I could see going with your way of thinking, and thusly I
proclaim these two universal truths about those who have programmed in
C:
The probability of you committing undefined bahavior is greater than
50%. Note that it's "greater than" and not "greater than or equal to.
The probability of you committing undefined bahavior that results in
formatting of your hard drive is less than 50%. Note that it's "less
than" and not "less than or equal to".
Regards
--
jay
.
- Follow-Ups:
- Re: casting
- From: Richard Heathfield
- Re: casting
- References:
- casting
- From: Christian Christmann
- Re: casting
- From: CBFalconer
- Re: casting
- From: Keith Thompson
- Re: casting
- From: CBFalconer
- casting
- Prev by Date: Re: Why the C committee doesn't provide an implementation when the standard is published?
- Next by Date: Re: Why the C committee doesn't provide an implementation when the standard is published?
- Previous by thread: Re: casting
- Next by thread: Re: casting
- Index(es):