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


Groups > comp.lang.c > #4039

Re: I need help

Path csiph.com!x330-a1.tempe.blueboxinc.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date Sun, 15 May 2011 18:45:48 -0500
Message-ID <4DD065AF.184F@mindspring.com> (permalink)
Date Sun, 15 May 2011 19:45:51 -0400
From pete <pfiland@mindspring.com>
Reply-To pfiland@mindspring.com
Organization PF
X-Mailer Mozilla 3.04Gold (WinNT; I)
MIME-Version 1.0
Newsgroups comp.lang.c
Subject Re: I need help
References <04ee4fd1-29ef-4640-a906-22055187c1e4@glegroupsg2000goo.googlegroups.com> <iqm0nq$7st$1@dont-email.me> <iqph2n$1vh$1@speranza.aioe.org> <iqpkhl$c51$1@dont-email.me>
Content-Type text/plain; charset=us-ascii
Content-Transfer-Encoding 7bit
Lines 27
X-Usenet-Provider http://www.giganews.com
NNTP-Posting-Host 4.154.217.250
X-Trace sv3-njrOBtWWO4PjsmWSDW9Vr/elFahtf4WlWoWMrg9nnBR0eNlMnhymcs52rxAM14ILBkDdmSbX2BxWEvI!pjI3YlZfWtKCF7fA/IVD58ExiQ+eJ9ylqC378vDYsjTMNhsmbIiISAfgvzV/hwpRIhFZmtd1gOyc!7nUkUpxWqZ0=
X-Abuse-and-DMCA-Info Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info Otherwise we will be unable to process your complaint properly
X-Postfilter 1.3.40
X-Original-Bytes 2009
Xref x330-a1.tempe.blueboxinc.net comp.lang.c:4039

Show key headers only | View raw


Eric Sosman wrote:
> 
> On 5/15/2011 5:37 PM, sandeep wrote:
> > Eric Sosman writes:
> >>      char *space = strchr(karmarkar, ' '); if (space == NULL)
> >>          printf ("No spaces\n");
> >>      else
> >>          printf ("First space is at position %u\n",
> >>              (unsigned)(space - karmarkar));
> >
> > This could give the wrong answer on implementations
> > where PTRDIFF_MAX > UINT_MAX.
> 
>      Thank you so very, very much for this helpful observation,
> guaranteed to clarify matters for the O.P. 

sandeep is wrong.
The context (snipped by sandeep)
for which your code was written, is this:
    char* karmarkar = "Karmarkar   958572";

And in that context, there is no way that the difference
between (space) and (karmarkar) can excede either UINT_MAX
or PTRDIFF_MAX (which would be a different C trivia point).

-- 
pete

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


Thread

I need help janus <emekamicro@gmail.com> - 2011-05-14 04:05 -0700
  Re: I need help "Heinrich Wolf" <invalid@invalid.invalid> - 2011-05-14 13:30 +0200
    Re: I need help "Joachim Schmitz" <jojo.nospam@schmitz-digital.de> - 2011-05-14 13:46 +0200
      Re: I need help "Heinrich Wolf" <invalid@invalid.invalid> - 2011-05-14 14:20 +0200
    Re: I need help Columbus sailed the ocean China Blue <chine.bleu@yahoo.com> - 2011-05-14 04:48 -0700
  Re: I need help "Joachim Schmitz" <jojo.nospam@schmitz-digital.de> - 2011-05-14 13:39 +0200
    Re: I need help "Joachim Schmitz" <jojo.nospam@schmitz-digital.de> - 2011-05-14 13:44 +0200
    Re: I need help "Heinrich Wolf" <invalid@invalid.invalid> - 2011-05-14 14:23 +0200
      Re: I need help "Joachim Schmitz" <jojo.nospam@schmitz-digital.de> - 2011-05-16 16:47 +0200
    Re: I need help James Kuyper <jameskuyper@verizon.net> - 2011-05-14 09:14 -0400
      Re: I need help "Joachim Schmitz" <jojo.nospam@schmitz-digital.de> - 2011-05-16 16:43 +0200
        Re: I need help Keith Thompson <kst-u@mib.org> - 2011-05-16 08:23 -0700
          Re: I need help Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-05-16 23:00 +0100
            Rationale for Shao Miller <sha0.miller@gmail.com> - 2011-05-16 23:40 -0500
              Re: Rationale for Some of 6.7.3p9? Shao Miller <sha0.miller@gmail.com> - 2011-05-16 23:43 -0500
                Re: Rationale for Some of 6.7.3p9? Heikki Kallasjoki <see@end.of.message.invalid> - 2011-05-17 06:06 +0000
                Re: Rationale for Some of 6.7.3p9? Heikki Kallasjoki <see@end.of.message.invalid> - 2011-05-17 06:13 +0000
                Re: Rationale for Some of 6.7.3p9? Angel <angel+news@spamcop.net> - 2011-05-17 14:03 +0000
                Re: Rationale for Some of 6.7.3p9? Shao Miller <sha0.miller@gmail.com> - 2011-05-17 10:19 -0400
              Re: Rationale for Ike Naar <ike@iceland.freeshell.org> - 2011-05-17 06:09 +0000
                Re: Rationale for Shao Miller <sha0.miller@gmail.com> - 2011-05-17 10:20 -0400
  Re: I need help Columbus sailed the ocean China Blue <chine.bleu@yahoo.com> - 2011-05-14 04:45 -0700
  Re: I need help Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-05-14 09:39 -0400
    Re: I need help sandeep <nospam@nospam.com> - 2011-05-15 21:37 +0000
      Re: I need help Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-05-15 18:35 -0400
        Re: I need help pete <pfiland@mindspring.com> - 2011-05-15 19:45 -0400
          Re: I need help pete <pfiland@mindspring.com> - 2011-05-15 20:15 -0400
        Re: I need help sandeep <nospam@nospam.com> - 2011-05-16 18:27 +0000
          Re: I need help Shao Miller <sha0.miller@gmail.com> - 2011-05-16 14:45 -0400
          Re: I need help Keith Thompson <kst-u@mib.org> - 2011-05-16 11:41 -0700
            Re: I need help Seebs <usenet-nospam@seebs.net> - 2011-05-16 19:12 +0000
              Re: I need help Keith Thompson <kst-u@mib.org> - 2011-05-16 12:30 -0700
                Re: I need help Seebs <usenet-nospam@seebs.net> - 2011-05-16 20:09 +0000
                Re: I need help sandeep <nospam@nospam.com> - 2011-05-16 20:35 +0000
                Re: I need help Ben Bacarisse <ben.usenet@bsb.me.uk> - 2011-05-16 23:22 +0100
                Re: I need help David Thompson <dave.thompson2@verizon.net> - 2011-05-24 01:19 -0400
              Re: I need help Tim Rentsch <txr@alumni.caltech.edu> - 2011-05-19 00:19 -0700
                Re: I need help Seebs <usenet-nospam@seebs.net> - 2011-05-19 14:37 +0000
                Re: I need help Keith Thompson <kst-u@mib.org> - 2011-05-19 08:17 -0700
                Re: I need help Seebs <usenet-nospam@seebs.net> - 2011-05-19 16:08 +0000
                Re: I need help Tim Rentsch <txr@alumni.caltech.edu> - 2011-05-19 11:13 -0700
      Re: I need help Keith Thompson <kst-u@mib.org> - 2011-05-16 08:12 -0700

csiph-web