Re: What is the point of signed char?
- From: "Peter Nilsson" <airia@xxxxxxxxxxx>
- Date: 27 Jul 2005 16:26:36 -0700
Keith Thompson wrote:
> "Peter Nilsson" <airia@xxxxxxxxxxx> writes:
> > Keith Thompson wrote:
> >> "Peter Nilsson" <airia@xxxxxxxxxxx> writes:
> >> > Keith Thompson wrote:
> >> > > ...you can detect the non-conformance by the lack
> >> > > of a diagnostic.
> >> >
> >> > ...there is nothing in the standard that says a given implementation
> >> > _cannot_ issue a diagnostic in a circumstance that would require one!
> >> >
> >> > You say the [snipped] code above requires a diagnostic... fine! My
> >> > implementation will issue a diagnostic. Now where's the conformance
> >> > issue?
> >>
> >> There's none that I can see. But you're describing an implementation
> >> that typedefs int8_t as plain char, then goes out of its way to hide
> >> the fact that it's done so. As far as its behavior is concerned, you
> >> might as well say that it typedefs int8_t as signed char
> >
> > That's the 'as if' rule in action.
>
> Not really.
>
> Strictly speaking, the "as if" rule has to do with expression
> evaluation. In the C99 standard, the index entry for "as-if rule"
> points to 5.1.2.3, ...
Okay, I was speaking about the rule in a broader sense that C is
an abstract language.
> >> (and issues some annoying additional diagnostics).
> >
> > No, it issues the _required_ diagnostic, whether it's annoying or not.
>
> I'm starting to lose track of what we're talking about. Let me try to
> summarize. ...
We're on the same wavelength, it's just that you seem to see a
difference between a conforming implementation and a 'contrived'
conforming implementation.
> >> That doesn't strike me as either useful or interesting.
> >
> > The specific case in question isn't interesting because of its highly
> > contrived nature, but real implementations can and do go out of their
> > way _merely_ to satisfy conformance. Tedious required diagnostics are
> > just one example.
>
> Do you have some examples in mind?
Lots. There are plenty of extensions that require diagnostics on a
conforming implementation, e.g. long long under C90.
On most implementations, specific required diagnostics are often
suppressed unless the implementation is invoked in conforming mode.
In many such cases, the implementation has to perform additional
work to detect and diagnose the constraint violation.
Another example: many implementations that I've used won't diagnose...
unsigned char *foo = 0xFFFE;
....unless they are told to. Such definitions are part of the context
free portion of the grammar, and irrespective of the constraint
violation, an implementation must define semantics for the conversion
involved. So, detecting and issuing a diagnostic is just extra work
that an implementation will do if it wishes to claim conformance.
That extra work doesn't add to the capabilities of the
implementation beyond conformance.
> Satisfying comformance isn't "mere" in my opinion;
Of course it isn't. I am focussing on diagnostics. The core job of
an implementation is to translate correct source into efficient code.
Diagnostics may be value adding and best practice, but they don't
change the semantics of the language.
> I'm trying to understand just what your point is. Can you
> summarize it in a few sentences?
You seem to understand my points just fine, we just differ in personal
emphasis.
--
Peter
.
- References:
- What is the point of signed char?
- From: ng5000
- Re: What is the point of signed char?
- From: junky_fellow
- Re: What is the point of signed char?
- From: ng5000
- Re: What is the point of signed char?
- From: Lawrence Kirby
- Re: What is the point of signed char?
- From: Peter Nilsson
- Re: What is the point of signed char?
- From: Keith Thompson
- Re: What is the point of signed char?
- From: Peter Nilsson
- Re: What is the point of signed char?
- From: Keith Thompson
- Re: What is the point of signed char?
- From: Peter Nilsson
- Re: What is the point of signed char?
- From: Keith Thompson
- Re: What is the point of signed char?
- From: Peter Nilsson
- Re: What is the point of signed char?
- From: Keith Thompson
- What is the point of signed char?
- Prev by Date: Re: 1/2 =?
- Next by Date: Re: 1/2 =?
- Previous by thread: Re: What is the point of signed char?
- Next by thread: Re: What is the point of signed char?
- Index(es):