Path: csiph.com!news.swapon.de!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: C pointer semantics with dynamically allocated struct Date: Sat, 17 Oct 2015 14:50:02 -0700 Organization: None to speak of Lines: 24 Message-ID: References: <561e2e49.3744281@news.xs4all.nl> <537dc231-7dc2-4ecb-8d55-4d847c9e8e0c@googlegroups.com> <29db6d81-16ae-4f18-9a3a-ac290b823144@googlegroups.com> <839bc0ff-6090-4171-956b-10cd0db49129@googlegroups.com> <256ffb24-2a28-490d-88a3-07655412daa7@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="12841"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+8JvwgAeBA80LMP4I2+xXT" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:Ej+omsCIFeeEOeHzMVM/cTbOLN4= sha1:fnIVIzY6flEhHIsD3GV7hC2KVzA= Xref: csiph.com comp.lang.c:73158 supercat@casperkitty.com writes: > On Friday, October 16, 2015 at 6:43:38 PM UTC-5, glen herrmannsfeldt wrote: >> I wonder why signed char exists at all. I suspect that there is some >> system that makes it hard to process unsigned char data. That is, where >> char at sign extended on promotion to larger types. With extra >> instructions, (presumably used for actual (unsigned char), it does >> do the conversion. That saves code space and execution time, for a >> rarely occuring (on ASCII systems) negative char values. > > There are many situations where 8-bit signed values are useful. Further, I > believe INT_MAX is supposed to be at least equal to CHAR_MAX, which would > imply that on systems where sizeof (int) is 1, "char" would have to be > signed. There is no such requirement. Systems with CHAR_MAX > INT_MAX would have some difficulties with stdio (in particular a program couldn't distinguish between EOF and a valid character without checking the results of feof() and ferror()), but they're not prohibited. -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for JetHead Development, Inc. "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister"