Topic: explicit class" (proposal N1582)


Author: c141592653589@hotmail.com (MJ)
Date: Sat, 10 Apr 2004 16:10:43 +0000 (UTC)
Raw View
francis@robinton.demon.co.uk (Francis Glassborow) wrote in message news:<ksSQ$QChzQdAFw0D@robinton.demon.co.uk>...

> >Furthermore, in an "explicit class" I would expect that the implicit
> >conversion for constructors is turned off (as if the constructors were
> >declared as "explicit"). Are constructors in an "explicit class"
> >implicitly declared as explicit?
>
> There is a problem here in that we do not have a mechanism for switching
> conversion behaviour back on. However as the author of the paper I am
> considering how that option might be incorporated. Perhaps adding
> '!explicit' and its equivalent 'not explicit' might serve without
> costing another keyword.

I would allow that for regular classes too. So compilers could
generate warnings. Writing '!explicit' (or however the syntax might
look) would then suppress the 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.jamesd.demon.co.uk/csc/faq.html                       ]





Author: c141592653589@hotmail.com (MJ)
Date: Thu, 8 Apr 2004 00:10:12 +0000 (UTC)
Raw View
Proposal N1582 suggests to disable the automatic generation of the
following functions:

- default constructor
- copy constructor
- copy assignment operator
- destructor

I didn't find anything about the address operator. Is the address
operator function also supposed to be disabled in an "explicit class"?

Furthermore, in an "explicit class" I would expect that the implicit
conversion for constructors is turned off (as if the constructors were
declared as "explicit"). Are constructors in an "explicit class"
implicitly declared as explicit?


Cheers,
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.jamesd.demon.co.uk/csc/faq.html                       ]





Author: francis@robinton.demon.co.uk (Francis Glassborow)
Date: Thu, 8 Apr 2004 21:05:02 +0000 (UTC)
Raw View
In article <423c153c.0404070224.bd836ab@posting.google.com>, MJ
<c141592653589@hotmail.com> writes
>Proposal N1582 suggests to disable the automatic generation of the
>following functions:
>
>- default constructor
>- copy constructor
>- copy assignment operator
>- destructor
>
>I didn't find anything about the address operator. Is the address
>operator function also supposed to be disabled in an "explicit class"?

This is under consideration as are a number of other possible additions
some of which are somewhat revolutionary (such as looking at mechanisms
for making private members invisible and so not participate in overload
resolution). In the case of operator & I am not sure whether it is
better characterised as auto generated (as is operator =) or can be
overloaded in class scope (as is operator new). I think either view is
supportable.

>
>Furthermore, in an "explicit class" I would expect that the implicit
>conversion for constructors is turned off (as if the constructors were
>declared as "explicit"). Are constructors in an "explicit class"
>implicitly declared as explicit?

There is a problem here in that we do not have a mechanism for switching
conversion behaviour back on. However as the author of the paper I am
considering how that option might be incorporated. Perhaps adding
'!explicit' and its equivalent 'not explicit' might serve without
costing another keyword.

>

--
Francis Glassborow      ACCU
Author of 'You Can Do It!' see http://www.spellen.org/youcandoit
For project ideas and contributions: http://www.spellen.org/youcandoit/projects

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