class IXMLProcessor{public:virtual void startDocument() = 0;virtual void endDocument() = 0;virtual void startElement(const QName *name) = 0;virtual void endElement() = 0;virtual void attribute(const QName *name, const String &text) = 0;virtual void text(const String &text) = 0;virtual void comment(const String &text) = 0;virtual ~XMLStream() {}};class MyXMLProcessor{public:virtual void startDocument() override;virtual void endDocument() override;virtual void startElement(const QName *name) override;virtual void endElement() override;virtual void attribute(const QName *name, const String &text) override;virtual void text(const String &text) override;virtual void comment(const String &text) override;virtual ~XMLStream() {}};
class IXMLProcessor{public, virtual, =0:void startDocument();void endDocument();void startElement(const QName *name);void endElement();void attribute(const QName *name, const String &text);void text(const String &text);void comment(const String &text);public:virtual ~XMLStream() {}};class MyXMLProcessor{public, virtual, override:void startDocument();void endDocument();void startElement(const QName *name);void endElement();void attribute(const QName *name, const String &text);void text(const String &text);void comment(const String &text);};
template<class T>class numeric_limits{public:static constexpr const bool is_specialized = false;static constexpr T min() __ntl_nothrow;static constexpr T max() __ntl_nothrow;static constexpr T lowest() __ntl_nothrow;static constexpr const int digits = 0;static constexpr const int digits10 = 0;static constexpr const bool is_signed = false;static constexpr const bool is_integer = false;static constexpr const bool is_exact = false;static constexpr const int radix = 0;static constexpr T epsilon() __ntl_nothrow;static constexpr T round_error() __ntl_nothrow;static constexpr const int min_exponent = 0;static constexpr const int min_exponent10 = 0;static constexpr const int max_exponent = 0;static constexpr const int max_exponent10 = 0;static constexpr const bool has_infinity = false;static constexpr const bool has_quiet_NaN = false;static constexpr const bool has_signaling_NaN = false;static constexpr const float_denorm_style has_denorm = denorm_absent;static constexpr const bool has_denorm_loss = false;static constexpr T infinity() __ntl_nothrow;static constexpr T quiet_NaN() __ntl_nothrow;static constexpr T signaling_NaN() __ntl_nothrow;static constexpr T denorm_min() __ntl_nothrow;static constexpr const bool is_iec559 = false;static constexpr const bool is_bounded = false;static constexpr const bool is_modulo = false;static constexpr const bool traps = false;static constexpr const bool tinyness_before = false;static constexpr const float_round_style round_style = round_toward_zero;}; //template class numeric_limits
template<class T>class numeric_limits{public, static, constexpr:const bool is_specialized = false;T min() __ntl_nothrow;// { return T(false); }T max() __ntl_nothrow;// { return T(false); }T lowest() __ntl_nothrow;// { return T(false); }const int digits = 0;const int digits10 = 0;const bool is_signed = false;const bool is_integer = false;const bool is_exact = false;const int radix = 0;T epsilon() __ntl_nothrow;// { return T(false); }T round_error() __ntl_nothrow;// { return T(false); }const int min_exponent = 0;const int min_exponent10 = 0;const int max_exponent = 0;const int max_exponent10 = 0;const bool has_infinity = false;const bool has_quiet_NaN = false;const bool has_signaling_NaN = false;const float_denorm_style has_denorm = denorm_absent;const bool has_denorm_loss = false;T infinity() __ntl_nothrow;// { return T(false); }T quiet_NaN() __ntl_nothrow;// { return T(false); }T signaling_NaN() __ntl_nothrow;// { return T(false); }T denorm_min() __ntl_nothrow;// { return T(false); }const bool is_iec559 = false;const bool is_bounded = false;const bool is_modulo = false;const bool traps = false;const bool tinyness_before = false;const float_round_style round_style = round_toward_zero;};
--
---
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposal...@isocpp.org.
To post to this group, send email to std-pr...@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
Maybe it's time to get rid of = 0, and add abstract as a keyword.
It might be interesting to discuss the merits of verbose and non verbose with regard to cut and pasting lines and how such syntactic option helps or hinders that.
Sorry I didn't mean "get rid of = 0" to suggest actually make it illegal or deprecate it, it was just a bad turn of phrase.I just meant introduce abstract since it is nicer IMHO. I like abstract as a proposal on it's own, but I suggested abstract as much as an aid to this proposal.With the kind of fix it tools we are now seeing appear in clang etc. it wouldn't be that hard I would think to create a conversion tool to replace all = 0 with abstract either.
Another related syntactic change but going in the opposite direction might be to allow public: etc. without a colon, for those who prefer to go to be verbose and spell out each function in full. .e.g.:class B {public void f1();private void f2();};It might be interesting to discuss the merits of verbose and non verbose with regard to cut and pasting lines and how such syntactic option helps or hinders that.
While I'm talking about ideas that probably won't get overwhelming approval regarding these keywords, perhaps it's time to deprecate private inheritance too, such that:class X : Dgenerates a warning for the next 10 years, unless : private D is used instead. Then eventually it could be deprecated and default to public inheritance or left as is then as it still improves clarity even if the default is not changed later.
I tend to agree, but what about this:
class A {
public :
int method1();
int method2();
private int method3();
int method4();
private static:
void doSomething();
public doSomethingElse();
}
Is method3() public? private? ill-formed?
same question about method4.
Also, is doSomethingElse static?
Deprecating the use of " = 0 " in favor of an "abstract" keyword could be a nice addition I think.
The motivation can be that it is more natural for a programmer to use a keyword to mark methods as abstract than the " = 0" trick.
On 20 December 2013 03:55, <gmis...@gmail.com> wrote:
> Another related syntactic change but going in the opposite direction might
> be to allow public: etc. without a colon, for those who prefer to go to be
> verbose and spell out each function in full. .e.g.:
>
> class B {
> public void f1();
> private void f2();
> };
I fail to see why we'd do this, since it's a difference of one character.
Perhaps not, because I again fail to find sufficient motivation.
> The motivation can be that it is more natural for a programmer to use a
> keyword to mark methods as abstract than the " = 0" trick.
The 'trick' has been in the language forever. Claiming that it's more 'natural'
to use a keyword invented after 4 standard revisions have shipped is
a bold claim.
On 21 December 2013 01:58, Sean Middleditch <sean.mid...@gmail.com> wrote:
>> > class B {
>> > public void f1();
>> > private void f2();
>> > };
>> I fail to see why we'd do this, since it's a difference of one character.
> It's less error prone. If you just prefix the method with public: then that
Based on what evidence? If we add this form of an access specifier,
and then people end up making silly mistakes when they accidentally
use the legacy form, what's the conclusion of what's error-prone and what's
not?
> declaration _and all following ones_ are public until the next access
> specifier. It's also an issue when you want to mix member functions of
> differing privilege levels.
How common are such mixes?
> It's not a huge deal by any stretch, but it is certainly more than just "one
> character" difference and nothing else.
Agreed. It's much more than a "one character difference", it's a fair amount
of work at specifying it and implementing it, for questionable gain.
>> Perhaps not, because I again fail to find sufficient motivation.
> It confuses people. New users get tripped up by it often. Heck, I still
> sometimes forget the public specifier and then get bitten by unexpected
> compile errors.
I wouldn't trade such compiler errors for breaking an imperial boatload
of existing code.
>> > The motivation can be that it is more natural for a programmer to use a
>> > keyword to mark methods as abstract than the " = 0" trick.
>> The 'trick' has been in the language forever. Claiming that it's more
>> 'natural'
>> to use a keyword invented after 4 standard revisions have shipped is
>> a bold claim.
> It's hardly only just now being 'invented'. I even recall reading that
> Bjarne had planned this change to a keyword in the early days but avoided it
> to get things shipped and we've been stuck with =0 ever since.
That doesn't make changing from the current syntax to a new keyword
any more natural.
> Deprecating =0 is a bit much now of course, but offering 'abstract' as a
> synonym is a more open topic I'd think.
Well, it can certainly be discussed. Let's start with people finding a
good name for it.
I find it queasy that the first google search hits and wikipedia hits
describe an
"abstract method" as something that has no implementation. Shall we try "pure"
instead? A "pure function" has a fair amount of history that indicates
it may mean
something completely different than a pure virtual function.
Who do we help with this synonym, then?
What's "natural" is obviously subjective. But I'd bet that preferring "=0" to a real word is a minority view. I'd bet that "most people" would prefer a word rather than something that looks like an assignment expression.
If the equals-sign is a liability, and doesn't reflect the newer meaning related to definition, why keep it in "= abstract"? It's just confusing that defining a pure virtual function is supported, but not with an inline definition. (This furthermore makes the pure specifier incompatible with deduced return type.)
This whole thing is patently ridiculous. We have a syntax for declaring things abstract. Creating a new syntax does not allow the programmer to accomplish anything new, and does not make the code in question inherently easier to read. I can see no reason to change it other than saying "abstract" looks prettier, which is a terrible reason to make changes in the core language at this point.Billy O'Neal