Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #60810

Re: can this be done recursively

From Ben Bacarisse <ben.lists@bsb.me.uk>
Newsgroups comp.lang.c
Subject Re: can this be done recursively
Date 2015-04-22 23:14 +0100
Organization A noiseless patient Spider
Message-ID <87383rak09.fsf@bsb.me.uk> (permalink)
References <b0319922-1b5e-48d2-8cc7-5cd1a5e866e6@googlegroups.com> <e07362d0-5d7e-4243-acc6-bcf384298b69@googlegroups.com> <87egnc9brp.fsf@bsb.me.uk> <5538009B.9090306@verizon.net>

Show all headers | View raw


James Kuyper <jameskuyper@verizon.net> writes:

> On 04/22/2015 03:57 PM, Ben Bacarisse wrote:
> ...
>> There's also a technicality: ch should be declared to be int not char.
>> EOF is a negative integer value ...
>
> Correct.
>
>> ... guaranteed to be different from any
>> actualy character value that getchar can legitimately return.
>
> Citation, please? I found no such guarantee in the definition of EOF
> (7.21.1p3) nor in the definition of getchar() (7.21.7.6).

Right.  I forgot this was comp.lang.c and simplified matters for the OP.

> In the unlikely event that UCHAR_MAX > INT_MAX, getchar()'s definition
> combined with the reversibility requirements for I/O on binary streams
> (7.21.2p3) imply that getchar() must return EOF when reading a byte that
> was written by calling putchar(EOF).

I am not sure this 100% right.  The reversibility is phrased in terms of
characters and I can't persuade myself that putchar(EOF) must write a
character that will result in EOF being returned by getchar.  Might such
an implementation not use a character set smaller than the set of char
values -- for example, masking off one or more bits?  What do such
implementations normally do, or aren't there any?

-- 
Ben.

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

can this be done recursively G G <gdotone@gmail.com> - 2015-04-19 09:50 -0700
  Re: can this be done recursively Ben Bacarisse <ben.usenet@bsb.me.uk> - 2015-04-19 21:14 +0100
    Re: can this be done recursively G G <gdotone@gmail.com> - 2015-04-19 14:20 -0700
  Re: can this be done recursively Lew Pitcher <lew.pitcher@digitalfreehold.ca> - 2015-04-19 16:32 -0400
    Re: can this be done recursively G G <gdotone@gmail.com> - 2015-04-19 14:25 -0700
  Re: can this be done recursively Keith Thompson <kst-u@mib.org> - 2015-04-19 14:09 -0700
    Re: can this be done recursively G G <gdotone@gmail.com> - 2015-04-19 14:35 -0700
      Re: can this be done recursively jt@toerring.de (Jens Thoms Toerring) - 2015-04-19 22:57 +0000
  Re: can this be done recursively G G <gdotone@gmail.com> - 2015-04-20 04:30 -0700
    Re: can this be done recursively Richard Heathfield <rjh@cpax.org.uk> - 2015-04-20 12:49 +0100
      Re: can this be done recursively G G <gdotone@gmail.com> - 2015-04-20 05:28 -0700
      Re: can this be done recursively jt@toerring.de (Jens Thoms Toerring) - 2015-04-20 13:09 +0000
  Re: can this be done recursively G G <gdotone@gmail.com> - 2015-04-22 09:42 -0700
    Re: can this be done recursively Malcolm McLean <malcolm.mclean5@btinternet.com> - 2015-04-22 10:12 -0700
    Re: can this be done recursively James Kuyper <jameskuyper@verizon.net> - 2015-04-22 13:29 -0400
    Re: can this be done recursively Ben Bacarisse <ben.lists@bsb.me.uk> - 2015-04-22 20:57 +0100
      Re: can this be done recursively James Kuyper <jameskuyper@verizon.net> - 2015-04-22 16:12 -0400
        Re: can this be done recursively Ben Bacarisse <ben.lists@bsb.me.uk> - 2015-04-22 23:14 +0100
          Re: can this be done recursively James Kuyper <jameskuyper@verizon.net> - 2015-04-22 18:56 -0400
  Re: can this be done recursively G G <gdotone@gmail.com> - 2015-04-23 07:59 -0700

csiph-web