Topic: oops, but should the compiler catch it.
Author: Shankar Unni <shankar@webnexus.com>
Date: Sat, 19 May 2001 18:48:02 GMT Raw View
[OFF TOPIC, sorry..]
James Dennett wrote:
> [...] a compiler [...] which terminated
> successful, error-free runs by printing "None of the errors
> were found." A good warning, if ever I saw one.
Or, you could even go so far as the Metrowerks 5 C++ compiler, which
emits a message at the end of a successful compilation saying
ERROR: 0 errors
(Wow, the condition of having 0 errors is an error? :-).
--
Shankar Unni
shankar@webnexus.com
---
[ 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.research.att.com/~austern/csc/faq.html ]
Author: "Greg Brewer" <nospam.greg@brewer.net>
Date: Thu, 17 May 2001 14:29:45 CST Raw View
> It is, and this is a deliberate decision (one that I think is wrong).
Hmmm, would it be illegal for the compiler to issue a warning?
---
[ 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.research.att.com/~austern/csc/faq.html ]
Author: James Dennett <jdennett@acm.org>
Date: Thu, 17 May 2001 20:47:12 GMT Raw View
Greg Brewer wrote:
>
> > It is, and this is a deliberate decision (one that I think is wrong).
>
> Hmmm, would it be illegal for the compiler to issue a warning?
Never. Compilers can issue as many warnings as they feel
like, and still conform to the C++ Standard. Didn't someone
here (or in clcm) mention a compiler (for Fortran I think,
although the approach is valid in C++) which terminated
successful, error-free runs by printing "None of the errors
were found." A good warning, if ever I saw one.
-- James Dennett
---
[ 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.research.att.com/~austern/csc/faq.html ]
Author: "TiTi" <titi_@skynet.be>
Date: Mon, 14 May 2001 22:55:22 GMT Raw View
Greg Brewer <nospam.greg@brewer.net> schreef in berichtnieuws
9dh71j$1j5i$1@news.hal-pc.org...
> I just found the following
> class AC
> {
> public:
> CB &cb;
> AC(CB &cd) : cb(cb) {}
> };
>
> The compiler didn't catch it -- no warning or error. I assume it is legal
> but should it be?
Check GotW#80 (Order Order!) on comp.lang.c++.moderated.
TiTi
---
[ 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.research.att.com/~austern/csc/faq.html ]
Author: "TiTi" <titi_@skynet.be>
Date: Mon, 14 May 2001 22:56:40 GMT Raw View
Radoslav Getov <nospam@mai.com> schreef in berichtnieuws
tfvirhffj51e71@corp.supernews.com...
> "Greg Brewer" <nospam.greg@brewer.net> wrote in message
> news:9dh71j$1j5i$1@news.hal-pc.org...
> > I just found the following
> > class AC
> > {
> > public:
> > CB &cb;
> > AC(CB &cd) : cb(cb) {}
> > };
> >
> > The compiler didn't catch it -- no warning or error. I assume it is
legal
> > but should it be?
> It's even worse:
> int x = x;
> is legal I think and my compiler agrees, but should it be?
The question is, when is your object actually defined?
int x = x;
is equivalent to:
int x(x);
Now should the following compile?
struct X { X(const X& other); /*...*/};
X x(x);
X y = y;
IOW, you're trying to use an object before it is constructed.
TiTi
---
[ 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.research.att.com/~austern/csc/faq.html ]
Author: "Greg Brewer" <nospam.greg@brewer.net>
Date: Fri, 11 May 2001 22:39:41 GMT Raw View
I just found the following
class AC
{
public:
CB &cb;
AC(CB &cd) : cb(cb) {}
};
The compiler didn't catch it -- no warning or error. I assume it is legal
but should it be?
Greg Brewer
---
[ 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.research.att.com/~austern/csc/faq.html ]
Author: "Radoslav Getov" <nospam@mai.com>
Date: Mon, 14 May 2001 12:13:48 GMT Raw View
"Greg Brewer" <nospam.greg@brewer.net> wrote in message
news:9dh71j$1j5i$1@news.hal-pc.org...
> I just found the following
> class AC
> {
> public:
> CB &cb;
> AC(CB &cd) : cb(cb) {}
> };
>
> The compiler didn't catch it -- no warning or error. I assume it is legal
> but should it be?
>
> Greg Brewer
>
>
It's even worse:
int x = x;
is legal I think and my compiler agrees, but should it be?
Radoslav Getov
---
[ 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.research.att.com/~austern/csc/faq.html ]
Author: Francis Glassborow <francis.glassborow@ntlworld.com>
Date: Mon, 14 May 2001 13:33:58 GMT Raw View
In article <tfvirhffj51e71@corp.supernews.com>, Radoslav Getov
<nospam@mai.com> writes
>It's even worse:
>
>int x = x;
>
>is legal I think and my compiler agrees, but should it be?
It is, and this is a deliberate decision (one that I think is wrong).
PCLint++ picks this idiocy up (that was something I requested about six
years ago, and Gimpel Software added it very promptly)
Francis Glassborow ACCU
64 Southfield Rd
Oxford OX4 1PA +44(0)1865 246490
All opinions are mine and do not represent those of any organisation
---
[ 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.research.att.com/~austern/csc/faq.html ]