From -7626550120088853399
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,e92ba5a0251f1ca0
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2002-08-02 14:12:02 PST
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!kibo.news.demon.net!news.demon.co.uk!demon!mail2news.demon.co.uk!not-for-mail
From: Allan_W@my-dejanews.com (Allan W)
Newsgroups: comp.std.c++
Subject: Re: C++0x Wish List (deprecate null statement)
Date: Fri,  2 Aug 2002 21:11:12 GMT
Organization: http://groups.google.com/
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <23b84d65.0208021301.cad79c8@posting.google.com>
References: <23b84d65.0206181331.3d79ce9b@posting.google.com> <3d149fdd$0$233$ed9e5944@reading.news.pipex.net> <3D478FFA.75E92A7@webmaster.com> <_f029.31587$xj6.1928156@twister.southeast.rr.com>
X-Trace: mail2news.demon.co.uk 1028322677 mail2news:18705 mail2news mail2news.demon.co.uk
X-Complaints-To: abuse@demon.net
X-Mail2News-Path: news.demon.net!mulga.cs.mu.oz.au
X-Authentication-Warning: mulga.cs.mu.OZ.AU: fjh set sender to devnull@stump.algebra.com using -f
X-Robomod: STUMP, ichudov@algebra.com (Igor Chudov)
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
NNTP-Posting-Date: 2 Aug 2002 21:01:58 GMT
X-MailScanner: Passed
Lines: 40
Xref: archiver1.google.com comp.std.c++:13000

> > Stephen Howe wrote:
> > > I do not wish to see null statements deprecated, I use this
> > > all the time. I would write that as
> > >
> > > while (*(out++)=*(in++))
> > >     ;

> "David Schwartz" <davids@webmaster.com> wrote
> > This could just as well be:
> >
> > while (*(out++)=*(in++)) { }
> >
> > No null statement needed.

"Joe Gottman" <jgottman@carolina.rr.com> wrote
> Does this work inside a for loop?  That's one place where
> I use null statements all the time. For instance:
>     for (int n = 0; /* No condition */; ++n) {
>              /* Complicated code that eventually calls break */
>      }

I do not propose breaking that, or even deprecating it.

The middle part of a for statement is a condition, not a
statement. The reason you can omit it is that the syntax for
the for() statement declares the condition to be optional. (6.5)
Leaving it out is not the same thing as using a null statement.

However, even here there is an alternative:
   for (int n=0; true; ++n)
does exactly what you want, and I suspect (haven't tested it)
that even with optimizations turned off, most compilers will
generate identical code for this case.

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html                       ]



