Path: csiph.com!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 16:07:34 -0700 Organization: None to speak of Lines: 22 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> <17AUx.54254$756.53725@fx20.iad> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: mx02.eternal-september.org; posting-host="945944de09706c9b4e29b53c9d2efdc2"; logging-data="401"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+bdpROEFXg6+vaaonIu0PA" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:63WRYdHFI1ULLgMQRHBJZzZePYA= sha1:16RHO+hq/yh7JBqXUNXyxK3FL38= Xref: csiph.com comp.lang.c:73169 Richard Damon writes: [...] > Note that the problem with distinguishing EOF and a valid character > doesn't require CHAR_MAX > INT_MAX, as (as far as I know) there is no > requirement that all valid characters be positive, only those characters > in the basic character set be positive, others are allowed to be > negative, which is why you need to cast char to unsigned char when > calling the various isxxx classification functions with char values > (unless you know char is unsigned). The problem doesn't occur as long as all unsigned char values and EOF can be represented as distinct values within the range of int. Of course there's a problem for code that stores the result of getchar() in a char object, but as the Rationale says in another context, "such dubious possibilities need not be allowed for". -- 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"