Topic: keyword implicit


Author: cizarre@gmx.net (Michael Andres)
Date: Tue, 18 Sep 2001 11:57:02 GMT
Raw View
For many constructors, or may be for most constructors
it is recommendable to be declared as "explicit". But
as it is not required, programmers tend to omit the
"explicit-declaration".

A compiler that would issue a warning for an omitted
explicit-declaration, could help to avoid this. In
order to suppress the warning a new keyword, e.g.
"implicit" would be necessary.

Is there anyone out there who would be against this?


 - Michael

---
[ 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: Pete Becker <petebecker@acm.org>
Date: Tue, 18 Sep 2001 16:37:31 GMT
Raw View
Michael Andres wrote:
>
> For many constructors, or may be for most constructors
> it is recommendable to be declared as "explicit". But
> as it is not required, programmers tend to omit the
> "explicit-declaration".
>
> A compiler that would issue a warning for an omitted
> explicit-declaration, could help to avoid this. In
> order to suppress the warning a new keyword, e.g.
> "implicit" would be necessary.
>
> Is there anyone out there who would be against this?
>

Yes. Compilers should not natter about what some people consider good
style, since others may well disagree. This one in particular is not at
all clearcut: there are many cases where the purpose of a
single-argument constructor is to provide a conversion, and having to
say "Mother, may I" in order to get the compiler to approve of it is a
waste of time.

--
Pete Becker
Dinkumware, Ltd. (http://www.dinkumware.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: Ron Natalie <ron@sensor.com>
Date: Tue, 18 Sep 2001 16:38:11 GMT
Raw View

> A compiler that would issue a warning for an omitted
> explicit-declaration, could help to avoid this. In
> order to suppress the warning a new keyword, e.g.
> "implicit" would be necessary.
>
> Is there anyone out there who would be against this?

I am against mandating any compiler warnings.  It's either
compiles with the syntax and diagnosable semantic constraints
or it doesn't.  The standard rightfully doesn't propose levels
of program correctness.

If a compiler wants to issue a warning, that's up to the implementation.
It's a selling point to do so.  However, there are TONS of warnings
that compilers issue that are necessary to supress and nearly every
compiler that generates these has an way defined to supress them.
"implicit" would generate a new keyword solely for surpressing some
implementation defined diagnostic (which there is most likely an
implementation defined way of supressing).  I don't think that
has enough value to merit whittling away more of the namespace.

I'd be more intersted in some portable pragmas (someone suggested
the name dogma) if we are even going to think about surpessing
this kind of thing.

---
[ 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: comeau@panix.com (Greg Comeau)
Date: Tue, 18 Sep 2001 17:12:54 GMT
Raw View
In article <8fbd32b9.0109180306.4a267c97@posting.google.com>,
Michael Andres <cizarre@gmx.net> wrote:
>For many constructors, or may be for most constructors
>it is recommendable to be declared as "explicit". But
>as it is not required, programmers tend to omit the
>"explicit-declaration".
>
>A compiler that would issue a warning for an omitted
>explicit-declaration, could help to avoid this. In
>order to suppress the warning a new keyword, e.g.
>"implicit" would be necessary.
>
>Is there anyone out there who would be against this?

If I understand you, you want a standard keyword available
to suppress a warning that may not even exist?
If so, yes, I would be against this.
--
Greg Comeau         export ETA: Dec 1    10% "End of Summer" Offer
Comeau C/C++ ONLINE ==>     http://www.comeaucomputing.com/tryitout
World Class Compilers:  Breathtaking C++, Amazing C99, Fabulous C90.
Comeau C/C++ with Dinkumware's Libraries... Have you tried it?

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