can a character be negative?

K

Keith Thompson

BGB / cr88192 said:
<--
who says it's normally signed? I've seen compilers that made it
optional.
Since it hardly ever matters I don't understand why you care.
-->

it is normally signed, since this is what a majority of the compilers on a
majority of the common architectures do.

granted, it is not safe to rely on this, and hence I often use an explicit
signed type if it really matters.
[...]

Then you're using the word "normally" in a manner that's inconsistent
with the way I and, I believe, most other people use it.

Something is not "normal" just because it's in the majority, and it
certainly isn't abnormal just because it's in the minority.

(Your quoting convention, on the other hand, is abnormal, and your
article would be easier to read if you used the normal convention.)
 
B

BGB / cr88192

Keith Thompson said:
BGB / cr88192 said:
<--
who says it's normally signed? I've seen compilers that made it
optional.
Since it hardly ever matters I don't understand why you care.
-->

it is normally signed, since this is what a majority of the compilers on
a
majority of the common architectures do.

granted, it is not safe to rely on this, and hence I often use an
explicit
signed type if it really matters.
[...]

Then you're using the word "normally" in a manner that's inconsistent
with the way I and, I believe, most other people use it.

Something is not "normal" just because it's in the majority, and it
certainly isn't abnormal just because it's in the minority.

normal == "common as to the point of not typically being considered".

for example, "in the US people normally speak English".
this does not, for example, deny the existence of Mexicans, only that people
can "normally" disregard the possibility of them using Spanish when engaging
in conversations with people.

or, maybe, people normally speak Japanese in Japan.
....

(Your quoting convention, on the other hand, is abnormal, and your
article would be easier to read if you used the normal convention.)

mostly that particular bit of funkiness is this:
lazyness + OE + Google Groups;

as in:
Google Groups makes posts which mess up OE's quoting mechanism;
I am too lazy to go through every post in which this happens and put '>'
everywhere...

hence:
<--
....
-->

because this is much easier to type...
 
K

Keith Thompson

[...]
[referring to plain char]
it is normally signed, since this is what a majority of the
compilers on a majority of the common architectures do.

granted, it is not safe to rely on this, and hence I often use an
explicit signed type if it really matters.
[...]

Then you're using the word "normally" in a manner that's inconsistent
with the way I and, I believe, most other people use it.

Something is not "normal" just because it's in the majority, and it
certainly isn't abnormal just because it's in the minority.

normal == "common as to the point of not typically being considered".

Plain char being signed is not as common as you seem to think it is.
I recently posted several examples of systems where plain char is
unsigned.

[...]
mostly that particular bit of funkiness is this:
lazyness + OE + Google Groups;
[snip]

OE-QuoteFix. Either that, or take the time to fix your quoting
manually, for the sake of your readers (who are likely to spend more
cumulative time reading your words than you spent writing them).
 
N

Nick Keighley

It would be perverse.

?
Just repeating this doesn't make it true.
Anyone who had to make the decision, wouldn't
deliberately choose signed format for character data.

Where compilers give me the option I choose signed chars. It's more
likely
to help me find bugs in my char handling code.
It's just asking for trouble.

what you call "trouble" I call "help diagnosing a bug"
(Try creating a histogram of the 256 character codes used in some
text, you will need the character code to index into an array. It's a lot
easier with 0 to 255 rather than -128 to 127)

you add an offset on. It's hardly rocket science. chars are not small
ints.

There should have been a char type
yes

(unsigned, but that doesn't even need mentioning),

simnce we are arguing about it- yes it does.
and separate signed/unsigned ultra-short integers, ie.
byte-sized.

as long as you understand byte is not necessarily 8 bits.
(All easily added added with typedefs, but in practice, no-one
bothers.)

I do...
There's a few, such as ensuring your data just fitting into the memory of
your computer, rather than needing double the memory.

these days I don't normally worry about that

I haven't done any research but I'm guessing that a big chunk of the 'int'
variables in my code do only contain values representable in one byte. The
waste can be usually be ignored, on PCs, but in arrays/arrays of structs and
so on, it can be significant.

remember that most C interger operators work on ints not chars
so there could be a lot of converting back and forth. It *might*
even make the program larger to compress the data like this!
 
P

Phil Carmody

Keith Thompson said:
BGB / cr88192 said:
<--
who says it's normally signed? I've seen compilers that made it
optional.
Since it hardly ever matters I don't understand why you care.
-->

it is normally signed, since this is what a majority of the compilers on a
majority of the common architectures do.

granted, it is not safe to rely on this, and hence I often use an explicit
signed type if it really matters.
[...]

Then you're using the word "normally" in a manner that's inconsistent
with the way I and, I believe, most other people use it.

I don't believe I know a single person who I can be sure is part of
the 'most' you refer to. My girlfriend might be a counter-example,
but she refused to stick her flag firmly in either camp.
Something is not "normal" just because it's in the majority, and it
certainly isn't abnormal just because it's in the minority.

I've heard that before, likewise from an American. I think 'normal'
means more to yanks than to brits/eslers/eflers etc. . To the majority
of English speakers, normal doesn't need to imply anything more than
just being an unexceptional thing, not even majority is required;
there's no reference to 'norms' or anything any more. One might say
it's perfectly standard English nowadays to use it in this diluted
sense. Despite the lack of a standard defining the language.

"Normal" really means at 90 degrees, of course!

Phil
 
P

Phil Carmody

Richard Heathfield said:
BGB / cr88192 wrote: said:
[char] is normally signed, since this is what a majority of the
compilers on a majority of the common architectures do.

normal == "common as to the point of not typically being
considered".

IBM mainframes are so rare as to be not typically considered? That
will come as a huge surprise to the very many C programmers for whom
they are a daily reality.

We'd better warn the cardiac unit at the local hospital then!

Phil
 
N

Nick Keighley

[char] is normally signed, since this is what a majority of the compilers on
a majority of the common architectures do.
granted, it is not safe to rely on this, and hence I often use an
explicit signed type if it really matters.
Then you're using the word "normally" in a manner that's inconsistent
with the way I and, I believe, most other people use it.
Something is not "normal" just because it's in the majority, and it
certainly isn't abnormal just because it's in the minority.

normal == "common as to the point of not typically being considered".

for example, "in the US people normally speak English".
this does not, for example, deny the existence of Mexicans, only that people
can "normally" disregard the possibility of them using Spanish when engaging
in conversations with people.

not a very good example given the number of Spainish speakers.
Not everyone who speaks Spainish is Mexican or of Mexican origin.

or, maybe, people normally speak Japanese in Japan.

a better example


<snip>
 
P

Phil Carmody

Richard Heathfield said:
In the UK, blue eyes are normal. A trifle unusual, perhaps, but still
normal. Brown eyes are normal, too. So are greenish-grey eyes, and
various other mucky and hard-to-describe colours. But pink eyes are
definitely abnormal. AFAIK I have never met a person with pink eyes,
but they do happen.

Good examples. I was going to use "in the 21st century, in civilised
western society (NTS falacy covered), it's perfectly normal to be
homosexual". Eyes works even better. Richard, meet Anna sitting next
to me, she has pink eyes. (And says 'grrr!'.)
In fact, it's quite normal to use "normal" in this way...


...despite the lack of a norm.


Right, but that's an abnormal normal, normally used only by abnormal
people (mathematicians, engineers, programmers...).

I think the thread's headed off at a tangent now.

Phil
 
B

bartc

Nick said:
?
Just repeating this doesn't make it true.

(If you entered a skyscraper and found floor 0 was half-way up the building,
that wouldn't seem odd?)
these days I don't normally worry about that

Because your data happens to fit.
remember that most C interger operators work on ints not chars
so there could be a lot of converting back and forth. It *might*
even make the program larger to compress the data like this!

That would be programmer choice. If the program is likely to use a lot of
memory, it's going to be due to data not code.

It might make the program a little slower, but again that is a choice (I'm
assuming C compilers avoid widening where it is not strictly necessary). But
usually less, and more localised, memory use is better.
 
E

Eric Sosman

bartc said:
[... concerning the "perversity" of CHAR_MIN != 0 ...]

(If you entered a skyscraper and found floor 0 was half-way up the
building,
that wouldn't seem odd?)

It would seem quite usual, aside from the odd numbering.
I haven't checked to be absolutely sure, but I don't think
I've ever been in a skyscraper whose ground floor was its
bottommost floor, and I doubt that you have, either.
 
B

bartc

Eric said:
bartc said:
[... concerning the "perversity" of CHAR_MIN != 0 ...]

(If you entered a skyscraper and found floor 0 was half-way up the
building,
that wouldn't seem odd?)

It would seem quite usual, aside from the odd numbering.
I haven't checked to be absolutely sure, but I don't think
I've ever been in a skyscraper whose ground floor was its
bottommost floor, and I doubt that you have, either.

I see I'm not going to change anyone's point of view here, but let's try
this:

Nick said:
you add an offset on. It's hardly rocket science.

What about if arrays in C were INT_MIN-based instead of 0-based? Why would
this be a problem?

After all, anyone who wants 0-based arrays simply has to add an INT_MIN (or
is it -INT_MIN) offset to each index operation. It isn't 'rocket science'!
 
E

Eric Sosman

bartc said:
Eric said:
bartc said:
[... concerning the "perversity" of CHAR_MIN != 0 ...]

(If you entered a skyscraper and found floor 0 was half-way up the
building,
that wouldn't seem odd?)

It would seem quite usual, aside from the odd numbering.
I haven't checked to be absolutely sure, but I don't think
I've ever been in a skyscraper whose ground floor was its
bottommost floor, and I doubt that you have, either.

I see I'm not going to change anyone's point of view here,

Whether you change anyone's opinion about the merits of the
way C treats `char' is irrelevant. The question is "Can a
character be negative," the answer is "Yes," and no amount of
"I'm unhappy with that" is going to change matters. You may
think it would be nicer if the Sun rose in the South, and you
might even convince others you're right, but it will keep on
rising in the East anyhow, despite your excellent arguments.
but let's try
this:



What about if arrays in C were INT_MIN-based instead of 0-based? Why would
this be a problem?

After all, anyone who wants 0-based arrays simply has to add an INT_MIN (or
is it -INT_MIN) offset to each index operation. It isn't 'rocket science'!

I've seen people implement Heapsort in C by sticking an
unused [0] element at the start of the array, so maybe you're
right that some people find array indexing difficult to fathom.
Personally, I think such people are in the wrong line of work.
 
N

Nick Keighley

(If you entered a skyscraper and found floor 0 was half-way up the building,
that wouldn't seem odd?)

US building don't even a floor zero. And in the town where I grew up
it was not uncommon for there to be floors below the entry point
(steep
hills).

I'm dubious that analogies about buildings mean anything when talking
about representations of characters!
Because your data happens to fit.

oh true. I'm sure there are applications where this really matters
but I'm not in such a domain.
That would be programmer choice.

quite true

If the program is likely to use a lot of
memory, it's going to be due to data not code.

if you're talking toasters (are there really toasters with software
in them?) there might be tight constraints on both. I know someone
who
knows someone who wrote software to close the door on a car.

It might make the program a little slower, but again that is a choice (I'm
assuming C compilers avoid widening where it is not strictly necessary). But
usually less, and more localised, memory use is better.

I suspect its pretty rare. I'm just saying there's a cost to
compression
as well
 
N

Nick Keighley

Eric said:
bartc wrote:
[... concerning the "perversity" of CHAR_MIN != 0 ...]
(If you entered a skyscraper and found floor 0 was half-way up the
building, that wouldn't seem odd?)
    It would seem quite usual, aside from the odd numbering.
I haven't checked to be absolutely sure, but I don't think
I've ever been in a skyscraper whose ground floor was its
bottommost floor, and I doubt that you have, either.

I see I'm not going to change anyone's point of view here, but let's try
this:

I was youer certainty that set me off
:)

What about if arrays in C were INT_MIN-based instead of 0-based? Why would
this be a problem?

After all, anyone who wants 0-based arrays simply has to add an INT_MIN (or
is it -INT_MIN) offset to each index operation. It isn't 'rocket science'!

I grew up with languages where the lower bound was anything you
wanted.
I've long ago got used to the fact I sometimes have to bash to fit the
real
world into C's rather odd limitations. *I* think all arrays shoulds
start
from one. So there.
 
A

Antoninus Twink

Good examples. I was going to use "in the 21st century, in civilised
western society (NTS falacy covered), it's perfectly normal to be
homosexual". Eyes works even better.

Another classic example of "do as I day, not as I do" from two of the
self-appointed topicality police.

Pair of hypocrites.
 
P

Phil Carmody

Eric Sosman said:
I've seen people implement Heapsort in C by sticking an
unused [0] element at the start of the array, so maybe you're
right that some people find array indexing difficult to fathom.
Personally, I think such people are in the wrong line of work.

It simplifies the code greatly, and even works as a perfect place to
build a new entry before inserting it, for example. I think your
ability to comprehend others' code and designs must be lacking.

Phil
 
K

Kenny McCormack

Antoninus Twink said:
Another classic example of "do as I day, not as I do" from two of the
self-appointed topicality police.

It is perfectly clear that topicality is for other people.
Pair of hypocrites.

Of course.

But to be fair, Kiki's position has always been just ever so slightly
kinder and gentler than Dicky's. Kiki has maintained that the
topicality shit is actually for the benefit of the newbie. That he (the
newbie) will get better answers elsewhere.

The is, in fact, true, since CLC dispenses nothing but BS, bullying, and
character assasination. But that doesn't mean that it *should* be true.
Or that the fact that it is is anything for anyone to be proud of.
 
K

Kenny McCormack

Getting back to the topic from the subject line, I think
Kenny McCormack and Antoninus Twink are existence proofs
that a character *can* be negative.

Har har. Good one. LOL.
 
A

Antoninus Twink

Getting back to the topic from the subject line, I think Kenny
McCormack and Antoninus Twink are existence proofs that a character
*can* be negative.

Why did you choose to single out Kenny and me rather than any of the
scuzzbuckets engaged in a nasty, personal, long-running bullying
campaign against Jacob? - Heathfield, Mackintyre, Rosenau, "Teapot",
Carmody to name just a few.
 
S

Seebs

Why did you choose to single out Kenny and me rather than any of the
scuzzbuckets engaged in a nasty, personal, long-running bullying
campaign against Jacob? - Heathfield, Mackintyre, Rosenau, "Teapot",
Carmody to name just a few.

Probably because I've seen nothing to indicate any kind of "bullying
campaign", just comments and/or criticism he doesn't always deal with
from an engineering mindset. :)

-s
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,174
Latest member
BlissKetoACV
Top