Hi,
What's the point of a signed char? As I see it a char represents a
character (not an integer, use an int type e.g. short int if you want
an 8 bit number, or one of the new types, uint8 I think).
I don't know of any character sets that use negatives, e.g. 65 is 'A'
and -65 is 'a'?!?
I'm sure I'm missing something, any ideas?
Also, am I right in saying that the current standards state that
whether a char is signed or unsigned is implementation dependent?
Nick
Nov 15 '05
64 4522
In article <ln************@nuthaus.mib.org>, Keith Thompson <kst- u@mib.org> writes "Alexei A. Frounze" <al*****@chat.ru> writes: "Clark S. Cox III" <cl*******@gmail.com> wrote in message news:2005072114242875249%clarkcox3@gmailcom... On 2005-07-21 13:29:47 -0400, "Alexei A. Frounze" <al*****@chat.ru> said: > I know of 16-bit ones (char=short=int=16 bits, long=32 bits, long long=40 > bits).
Then that's a non-conforming implementation (long long is too small).
Really? You mean the standard says long long is at least 64 bits?
Yes. More precisely, the C99 standard requires the range of long long to be at least -9223372036854775807 .. +9223372036854775807 (-2**63+1 .. 2**63-1).
But are there actually any C99 compilers in general use?
But perhaps the compiler is a C90 compiler that supports long long as an extension. If so, it doesn't fail to conform to the C90 standard, at least for that reason.
--
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
\/\/\/\/\ Chris Hills Staffs England /\/\/\/\/
/\/\/ ch***@phaedsys.org www.phaedsys.org \/\/\
\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
"Mark McIntyre" <ma**********@spamcop.net> wrote in message
news:99********************************@4ax.com... On Thu, 21 Jul 2005 02:31:25 +0400, in comp.lang.c , "Alexei A. Frounze" <al*****@chat.ru> wrote:
"Mark McIntyre" <ma**********@spamcop.net> wrote in message news:48********************************@4ax.com.. . On Wed, 20 Jul 2005 14:11:01 +0400, in comp.lang.c , "Alexei A. Frounze" <al*****@chat.ru> wrote: ... >You mean it supports "symmetrical" 2's complemented?
The DS9K is animplementation that frowns severely on straying outside the Standard. If the standard doesn't require signed char to include -128, you can bet your bottom dollar that using it on the DS9K will invoke a nuclear strike on mars or send signed photos of your bottom to the patriarch of moscow. Or both. ...
Guys, is it absolutely required to respond like this?
like what?
And what's funny or bad in that I'm a Russian?
Who said there was anything funny or bad about being russian?
What have I done to you to read this now? Why do I get such a response in this group 2nd time this week?
You need to get a sense of humour. You also need to follow the link I posted, and read all about the stuff that ART produce. Or rather, that someone decided on the 1st of April many years ago, to pretend they produced. -- Mark McIntyre
Mark, if you feel I need a better sense of humor, so be it, but in return
I'd like to ask you to be more polite, watch your mouth. Yes, I've been to
that site and found the fun stuff you were talking about DS9K. That's fine
with the site and the jokes about DS9K, C, even the photos of my ass are OK
(no, I'm not saying, I'd taken a few and I or anyone else liked them, no,
but if you want I can make a few for you, if you're so interested in my ass
:). What is not OK, IMO, is when such jokes include relation to me as living
in Moscow/Russia or being Russian, or something else of my personality,
pointing to the fact that I'm different (from you or eveyone here, doesn't
matter). To me such a joke more as an insult, in which that particular
difference thing is *the cause* of the insult. How would you feel if I and
someone else (two or more people) called you twice or more times an American
dumass, which isn't really far from the thing you wrote? Wouldn't you
consider that something's wrong about these people or yourself? I would and
I believe it's not just me who would. Mind you, I had two such responses in
less than a week. I hope you didn't mean it, but I beg you not to do it
anymore, neither unconsciously nor on purpose. People may not like it.
Alex
"Mark McIntyre" <ma**********@spamcop.net> wrote in message
news:99********************************@4ax.com... On Thu, 21 Jul 2005 02:31:25 +0400, in comp.lang.c , "Alexei A. Frounze" <al*****@chat.ru> wrote:
"Mark McIntyre" <ma**********@spamcop.net> wrote in message news:48********************************@4ax.com.. . On Wed, 20 Jul 2005 14:11:01 +0400, in comp.lang.c , "Alexei A. Frounze" <al*****@chat.ru> wrote: ... >You mean it supports "symmetrical" 2's complemented?
The DS9K is animplementation that frowns severely on straying outside the Standard. If the standard doesn't require signed char to include -128, you can bet your bottom dollar that using it on the DS9K will invoke a nuclear strike on mars or send signed photos of your bottom to the patriarch of moscow. Or both. ...
Guys, is it absolutely required to respond like this?
like what?
And what's funny or bad in that I'm a Russian?
Who said there was anything funny or bad about being russian?
What have I done to you to read this now? Why do I get such a response in this group 2nd time this week?
You need to get a sense of humour. You also need to follow the link I posted, and read all about the stuff that ART produce. Or rather, that someone decided on the 1st of April many years ago, to pretend they produced. -- Mark McIntyre
Mark, if you feel I need a better sense of humor, so be it, but in return
I'd like to ask you to be more polite, watch your mouth. Yes, I've been to
that site and found the fun stuff you were talking about DS9K. That's fine
with the site and the jokes about DS9K, C, even the photos of my ass are OK
(no, I'm not saying, I'd taken a few and I or anyone else liked them, no,
but if you want I can make a few for you, if you're so interested in my ass
:). What is not OK, IMO, is when such jokes include relation to me as living
in Moscow/Russia or being Russian, or something else of my personality,
pointing to the fact that I'm different (from you or eveyone here, doesn't
matter). To me such a joke is more of an insult, in which that particular
difference thing is *the cause* of the insult. How would you feel if I and
someone else (two or more people) called you twice or more times an American
dumass and apparently emphasizing your being American? And that isn't really
far from the thing you wrote. Wouldn't you consider that something's wrong
about these people or yourself? I would and I believe it's not just me who
would. Mind you, I had two such responses in less than a week. I hope you
didn't mean it and I don't ask for any apologies, but I beg you not to do it
anymore, neither unconsciously nor on purpose. People may not like it.
Worse, you can't be sure that none decides to beat you up for such your
words. Some people would consider beating you up as a perfect response. So,
don't tempt the fate, or there may be someone after your own ass. :)
Alex
Alexei A. Frounze wrote: How would you feel if I and someone else (two or more people) called you twice or more times an American dumass and apparently emphasizing your being American?
It's worse than that, Alexei - Mark is Scottish. :-)
Mark wasn't trying to get on your case, honestly. He was a bit thoughtless,
and he's been using comp.lang.c for long enough that he sometimes confuses
thoughtlessness with efficiency. Many of us have been guilty of the same
thing.
At the moment, you have the sympathy of this newsgroup. Your best strategy
is to forgive Mark for being momentarily thoughtless, and get on with
discussing C rather than national sensitivities.
If he gives any more trouble, just shove his haggis up his sporran. That'll
sort him out. :-)
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk
mail: rjh at above domain
"Richard Heathfield" <in*****@address.co.uk.invalid> wrote in message
news:db**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com... Alexei A. Frounze wrote:
How would you feel if I and someone else (two or more people) called you twice or more times an American dumass and apparently emphasizing your being American? It's worse than that, Alexei - Mark is Scottish. :-)
It's hard to tell Scottish :) Let calling him American be the punishment :))
Mark wasn't trying to get on your case, honestly. He was a bit
thoughtless, and he's been using comp.lang.c for long enough that he sometimes confuses thoughtlessness with efficiency. Many of us have been guilty of the same thing.
Well, that happens. Sometimes I'm bing picky or a bit harsh too. But I don't
write anything about one's place of living, nationality or religion in such
a way.
At the moment, you have the sympathy of this newsgroup. Your best strategy is to forgive Mark for being momentarily thoughtless, and get on with discussing C rather than national sensitivities.
OK. That's why I'm still subscribed for it, though I've already got the
answer to my C question.
If he gives any more trouble, just shove his haggis up his sporran.
That'll sort him out. :-)
He won't be able to stand such a shame and die. That's inhumane :)
Alex
Chris Hills <ch***@phaedsys.org> writes: In article <11*********************@g49g2000cwa.googlegroups. com>, Peter Nilsson <ai***@acay.com.au> writesLawrence Kirby wrote: On Tue, 19 Jul 2005 05:10:55 -0700, ng5000 wrote: > ... > If I'm worried about space then I could use int8_t (from > C99 stdint.h).
If int8_t exists then char must be an 8 bit type on that system. It is very likely that where it exists int8_t will be typedef'd as char or signed char. ...
I don't think that int8_t can be typedef'd as (plain) char in the strictest sense. C99 states that "int8_t denotes a signed integer type...", however plain char is not a signed integer type (per 6.2.5p4).
That said, the 'as if' rule applies!
MISRA-C (6.3) has
int8_t uint8_t char_t
as plain char is implementation defined.
What the heck is char_t? If it's a typedef for plain char, why not
just use plain char? Likewise for signed char or unsigned char.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
On Fri, 22 Jul 2005 13:12:41 +0400, in comp.lang.c , "Alexei A.
Frounze" <al*****@chat.ru> wrote: "Richard Heathfield" <in*****@address.co.uk.invalid> wrote in message news:db**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com... Alexei A. Frounze wrote:
> How would you feel if I and > someone else (two or more people) called you twice or more times an > American dumass and apparently emphasizing your being American?
I don't know, do you think its something you're likely to say? * It's worse than that, Alexei - Mark is Scottish. :-)
It's hard to tell Scottish :) Let calling him American be the punishment :))
Yeah, that fightin' talk. I'll see you outside laddie... :-) If he gives any more trouble, just shove his haggis up his sporran. That'll sort him out. :-)
He won't be able to stand such a shame and die. That's inhumane :)
Nah, it just gets a bit smelly after a couple of weeks.
* this is a quote from HHG2G by the way. If you've not read it - do.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
On Fri, 22 Jul 2005 03:57:00 GMT, in comp.lang.c , CBFalconer
<cb********@yahoo.com> wrote: Mark McIntyre wrote: On 20 Jul 2005 20:30:50 -0700, in comp.lang.c , "Netocrat" <ne******@dodo.com.au> wrote:
>On Thu, 21 Jul 2005 02:03:31 +0000, CBFalconer wrote: >Alexei can correct me if I'm wrong, but I believe his complaint was >against Mark's use of the phrase "send signed photos of your bottom to >the patriarch of moscow", which Alexei has interpreted as being a reference to Alexei >being Russian.
Certainly it was. I picked something that would be patently absurd to Alexei. If it'd been a USAnian, I'd have suggested awarding a spoken english degree to George W.
Mark, please keep your attributions straight. I wrote NONE of what you quoted.
Whoops, snipped not quite enough. Netocrat said all that. Many
apologies.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
On 21 Jul 2005 23:00:43 -0700, in comp.lang.c , "Netocrat"
<ne******@dodo.com.au> wrote: You obviously intended it to be taken as a joke put into a personalised context
Yup.
Alexei's response, particularly considering that he had earlier been deliberately and unequivocally insulted using his Russian nationality as part of the insult,
Had he? I wasn't aware of that.
does not necessarily stem from a lacking sense of humour/english skill either.
*shrug*. Personally, I felt that his reaction was over the top, but
not untypical of some fols I know who have either a lack of sense of
humour, or an overinflated sense of national importance, or a lack of
english skills. Obviously other opinions exist.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.ungerhu.com/jxh/clc.welcome.txt>
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! 120,000+ Newsgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----
On Fri, 22 Jul 2005 23:27:36 +0100, Mark McIntyre
<ma**********@spamcop.net> wrote: On Fri, 22 Jul 2005 13:12:41 +0400, in comp.lang.c , "Alexei A. Frounze" <al*****@chat.ru> wrote:
"Richard Heathfield" <in*****@address.co.uk.invalid> wrote in message news:db**********@nwrdmz03.dmz.ncs.ea.ibs-infra.bt.com... Alexei A. Frounze wrote:
> How would you feel if I and > someone else (two or more people) called you twice or more times an > American dumass and apparently emphasizing your being American? I don't know, do you think its something you're likely to say? * It's worse than that, Alexei - Mark is Scottish. :-) It's hard to tell Scottish :) Let calling him American be the punishment :))
Yeah, that fightin' talk. I'll see you outside laddie... :-)
The Scots are all Irish living in wheelbarrows. Or was that the Picts? If he gives any more trouble, just shove his haggis up his sporran. That'll sort him out. :-)
He won't be able to stand such a shame and die. That's inhumane :)
Nah, it just gets a bit smelly after a couple of weeks.
It's also child abuse, since a sporran is a young haggis as eny fule no.
Personally, I prefer them in their old age as bagpipes...
* this is a quote from HHG2G by the way. If you've not read it - do.
The book and radio versions, at least. Is it in the recent film? I
haven't seen it yet.
Chris C
Keith Thompson wrote: "Peter Nilsson" <ai***@acay.com.au> writes: Keith Thompson wrote: "Peter Nilsson" <ai***@acay.com.au> writes: > Lawrence Kirby wrote: >> On Tue, 19 Jul 2005 05:10:55 -0700, ng5000 wrote: >> > ... >> > If I'm worried about space then I could use int8_t (from >> > C99 stdint.h). >> >> If int8_t exists then char must be an 8 bit type on that system. It >> is very likely that where it exists int8_t will be typedef'd as char >> or signed char. ... > > I don't think that int8_t can be typedef'd as (plain) char in the > strictest sense. C99 states that "int8_t denotes a signed integer > type...", however plain char is not a signed integer type (per > 6.2.5p4). > > That said, the 'as if' rule applies!
If you're correct that int8_t can't be typedef'ed as plain char, the "as if" rule doesn't apply. The following would be illegal:
int8_t *iptr; unsigned char *cptr; cptr = iptr;
[I think the intended example is really...
int8_t *ip = ...;
char *cp = ip;
] ... The point, I guess, is that the above code fragment violates a constraint on any possible conforming implementation. If an implementation chose to take advantage of the "as if" rule, as Lawrence Kirby suggested, the lack of a diagnostic would demonstrate that the implementation is non-conforming.
True, but any implementation can issue a diagnostic for any construct
whether it violates a constraint or not.
AFAICS, implementations are allowed to make int8_t an exteneded integer type. Consider an implementation where signed char is not 2c, but the implementation can mimic a signed 2c octet integer.
But whether it's int8_t, size_t, time_t, etc..., no strictly conforming C99 program can determine _which_ typedef was invoked.
That's the point I was making. The standard doesn't appear to allow int8_t to be typedef-ed as a plain char, but the only way to check it is by looking at the implementation source code (if any), which is irrelevant.
Agreed, *except* that you can detect the non-conformance by the lack of a diagnostic.
True, but there is nothing in the standard that says a given
implementation
_cannot_ issue a diagnostic in a circumstance that would require one!
The code detects _careless_ non-conforming implementations. But that
goes for any strictly conforming code applied to any implementation
claiming conformance.
You say the code above requires a diagnostic... fine! My implementation
will issue a diagnostic. Now where's the conformance issue?
--
Peter
"Peter Nilsson" <ai***@acay.com.au> writes: Keith Thompson wrote: "Peter Nilsson" <ai***@acay.com.au> writes: > Keith Thompson wrote: >> "Peter Nilsson" <ai***@acay.com.au> writes: >> > Lawrence Kirby wrote: >> >> On Tue, 19 Jul 2005 05:10:55 -0700, ng5000 wrote: >> >> > ... >> >> > If I'm worried about space then I could use int8_t (from >> >> > C99 stdint.h). >> >> >> >> If int8_t exists then char must be an 8 bit type on that system. It >> >> is very likely that where it exists int8_t will be typedef'd as char >> >> or signed char. ... >> > >> > I don't think that int8_t can be typedef'd as (plain) char in the >> > strictest sense. C99 states that "int8_t denotes a signed integer >> > type...", however plain char is not a signed integer type (per >> > 6.2.5p4). >> > >> > That said, the 'as if' rule applies! >> >> If you're correct that int8_t can't be typedef'ed as plain char, the >> "as if" rule doesn't apply. The following would be illegal: >> >> int8_t *iptr; >> unsigned char *cptr; >> cptr = iptr; [I think the intended example is really...
int8_t *ip = ...; char *cp = ip; ]
Yes, thank you. ... The point, I guess, is that the above code fragment violates a constraint on any possible conforming implementation. If an implementation chose to take advantage of the "as if" rule, as Lawrence Kirby suggested, the lack of a diagnostic would demonstrate that the implementation is non-conforming.
True, but any implementation can issue a diagnostic for any construct whether it violates a constraint or not.
Sure, an implementation can issue a single meaningless diagnostic for
all translation units. > AFAICS, implementations are allowed to make int8_t an exteneded integer > type. Consider an implementation where signed char is not 2c, but the > implementation can mimic a signed 2c octet integer. > > But whether it's int8_t, size_t, time_t, etc..., no strictly > conforming C99 program can determine _which_ typedef was invoked. > > That's the point I was making. The standard doesn't appear to allow > int8_t to be typedef-ed as a plain char, but the only way to check > it is by looking at the implementation source code (if any), which > is irrelevant.
Agreed, *except* that you can detect the non-conformance by the lack of a diagnostic.
True, but there is nothing in the standard that says a given implementation _cannot_ issue a diagnostic in a circumstance that would require one!
The code detects _careless_ non-conforming implementations. But that goes for any strictly conforming code applied to any implementation claiming conformance.
You say the 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 (and issues
some annoying additional diagnostics). That doesn't strike me as
either useful or interesting.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Keith Thompson wrote: "Peter Nilsson" <ai***@acay.com.au> 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.
(and issues some annoying additional diagnostics).
No, it issues the _required_ diagnostic, whether it's annoying or not.
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.
--
Peter
"Peter Nilsson" <ai***@acay.com.au> writes: Keith Thompson wrote: "Peter Nilsson" <ai***@acay.com.au> 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, Program execution, which says:
In the abstract machine, all expressions are evaluated as
specified by the semantics. An actual implementation need not
evaluate part of an expression if it can deduce that its value is
not used and that no needed side effects are produced (including
any caused by calling a function or accessing a volatile object). (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.
The standard requires int8_t to be a typedef for a signed integer type
with width 8 (and a couple of other characteristics). Since plain
char is not a "signed integer type" even if it happens to be signed
(see 6.2.5), int8_t cannot legally be a typedef for plain char.
Either it's a typedef for signed char (if CHAR_BIT==8), or it's a
typedef for and extended signed integer type with the required
properties, or int8_t is not defined.
For any implementation, the following is a constraint violation
requiring a diagnostic:
char *cptr = 0;
int8_t *iptr = cptr; /* incompatible types */
An implementation that makes int8_t a typedef for plain char (which
we'll assume is signed) but is otherwise conforming most likely would
not issue a diagnostic for the initialization of iptr; because of
this, we can tell that the implementation is not conforming.
An implementation that makes int8_t a typedef for plain char but then
contrives to appear to be conforming anyway would have to issue the
required diagnostic for the initialization of iptr. Unless the
implementer is exceedingly clever and has way too much time on his
hands, it would probably also issue annoying diagnostics for
constructs that don't require them. For example:
typedef char plain_char;
char *cptr = 0;
plain_char *pcptr = cptr; /* annoying diagnostic (?) */
Spurious diagnostic like this don't make the implementation
non-conforming, of course. But if the implementer were sane, he would
simply make int8_t a typedef for signed char as soon as he realized
that making it a typedef for char is not allowed. 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? Satisfying comformance isn't
"mere" in my opinion; it's what implementations are supposed to do,
just as writers of application software can and do go out of their way
_merely_ to produce correct output. As for diagnostics, I've found
that the ones required by the C standard are insufficient -- which is
why good compilers and related tools produce additional non-required
diagnostics.
I'm trying to understand just what your point is. Can you summarize
it in a few sentences?
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
Keith Thompson wrote: "Peter Nilsson" <ai***@acay.com.au> writes: Keith Thompson wrote: "Peter Nilsson" <ai***@acay.com.au> 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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: MiniDisc_2k2 |
last post by:
Okay, here's a question about the standard. What does it say about
unsigned/signed mismatches in a comparison statement:
char a = 3;
unsigned char b = 255;
if (a<b)
Now what's the real...
|
by: Siemel Naran |
last post by:
Hi. Is there a way to convert the type signed int to the type unsigned int,
char to unsigned char, signed char to unsigned char, and so on for all the
fundamental integer types? Something like
...
|
by: Thelma Lubkin |
last post by:
I've been looking at code that handles string manipulation and I keep
seeing variable names, and function names, too, followed by a '$'.
I've also found a variable followed by a '%' symbol, but...
|
by: dam_fool_2003 |
last post by:
For int data type the default range starts from signed to unsigned. If
we don't want negative value we can force an unsigned value. The same
goes for long also.
But I don't understand why we have...
|
by: jacob navia |
last post by:
I would like to add at the beginning of the C tutorial I am writing
a short blurb about what "types" are. I came up with the following text.
Please can you comment?
Did I miss something?
Is...
|
by: tinesan |
last post by:
Hello fellow C programmers,
I'm just learning to program with C, and I'm wondering what the
difference between signed and unsigned char is. To me there seems to
be no difference, and the...
|
by: Frederick Gotham |
last post by:
The "toupper" function takes an int as an argument. That's not too
irrational given that a character literal is of type "int" in C.
(Although why it isn't of type "char" escapes me... )
The...
|
by: LuisC |
last post by:
What is better for holding small numbers in a program?
I know that char uses less memory, but, with 32 or 64 bits systems,
there are advantages (such as processing time) in using int instead of...
|
by: loudking |
last post by:
Hello, all
I don't quite understand what does ((time_t)-1) mean when I execute
"man 2 time"
RETURN VALUE
On success, the value of time in seconds since the Epoch is
retu
rned.
On error,...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |