From 5613499509030150676
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f78e5,e92ba5a0251f1ca0
X-Google-Attributes: gidf78e5,public
X-Google-ArrivalTime: 2002-06-20 10:33:01 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: Thu, 20 Jun 2002 17:32:11 GMT
Organization: http://groups.google.com/
Approved: Fergus Henderson <fjh@cs.mu.oz.au>, moderator of comp.std.c++
Message-ID: <69eb7585.0206191702.3294aadb@posting.google.com>
References: <23b84d65.0206181331.3d79ce9b@posting.google.com> <cefd6cde.0206190346.697f276@posting.google.com>
X-Trace: mail2news.demon.co.uk 1024594338 mail2news:12885 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: 20 Jun 2002 01:02:26 GMT
Lines: 47
Xref: archiver1.google.com comp.std.c++:12200

Michiel.Salters@cmg.nl (Michiel Salters) wrote
> Allan_W@my-dejanews.com (Allan W) wrote
> > The null statement is error-prone, because it's second nature to
> > use a semicolen at the end of every statement -- even where it
> > doesn't belong:
> > 
> >     if (a==b);
> >         TheyAreEqual(); // Oops! Called when it shouldn't be!
> > 
> > We can't simply make the null statement illegal -- too much legacy
> > code. But there are already alternatives today, so we can deprecate it.
> 
> Isn't this primarily a QoI thing? If your compiler issued a 
> "Warning: if-statement misses controlled statement (extra ';' ?)"
> would you still want the null-statement deprecated?

I suppose you could say this about any request to have some language
element deprecated. Compilers can always emit warning messages, even
when the code doesn't do anything illegal or deprecated.

I'd like something more official, though. As long as this syntax is
officially blessed, people are going to keep doing it, which means
that compilers are going to have to allow it, even if there are
diagnostics.

> I commonly write
> 
> catch (Ex)
> { ; }
> 
> and I think it's clear what this does; I don't think this usage should
> be deprecated.

As Michael Glassford pointed out, it's just as easy to use an
empty compound statement:

    catch (Ex)
        {}

Surely this is no less clear.

---
[ 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                       ]



