Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c++ > #72797

Re: Help needed

From "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com>
Newsgroups comp.lang.c++
Subject Re: Help needed
Date 2020-04-04 13:51 +0200
Organization A noiseless patient Spider
Message-ID <r69sbm$l63$1@dont-email.me> (permalink)
References (2 earlier) <slrnr8eu8f.e3c.nedlatham@woden.valhalla.oz> <slrnr8f5nu.1r7q.grahn+nntp@frailea.sa.invalid> <slrnr8fcd2.eb4.nedlatham@woden.valhalla.oz> <r691l0$idd$1@dont-email.me> <slrnr8g4vd.ep1.nedlatham@woden.valhalla.oz>

Show all headers | View raw


On 04.04.2020 06:58, Ned Latham wrote:
> James Kuyper wrote:
>> Ned Latham wrote:
>>> Jorgen Grahn wrote:
>>>> Ned Latham wrote:
>>>> ...
>>>>> C++ has become a moving target and a profligate producer of
>>>>> maintenance nightmares. My own projects are okay so far, but
>>>>> I've had to make so many fatuous changes that I'm now actively
>>>>> looking for languages to port them to.
>>>>
>>>> Which changes would that be?  Between, say a decent version two
>>>> decades ago (C++98) and a well-supported one today (C++11)?
>>>
>>> Exception throwing: once an option, now the default.
>>> "namespace":        once an option, now a requirement.
>>
>> Could you identify the specific changes in the text of the standard that
>> you're referring to, and when they happened?
> 
> No. I don't geek around with committee standards. The only C++ standard
> that I know is Stroustrup's: "Programming in C++", vol 3, 1997.

At that time, close up to the first standardization in 1998, the /de 
facto/ standard was the Annotated Reference Manual, the "ARM", by Bjarne 
Stroustrup and Margaret Ellis, IIRC.


> Exception throwing was optional back then

The standard exception hierarchy wasn't finished until close up to 
standardization, I believe about the time of that book, anyway after 1995.

As I recall Microsoft's Visual C++ didn't implement the new hierarchy 
until some years after the standardization, I believe in Visual 
Studio.NET in 2003 or so.


>, which suits me fine, because
> one of my projects is a library, and that is no place for exceptions
> (frankly, I think they encourage sloppy programming, and I eschew them
> at all times, not just in libraries). At some point, which I haven't
> reached yet, it became the default. When I reach that point, I'll be
> dropping back to the previous compiler.
> 
> Namespace wasn't on the curriculum when I started learning C++.
> I don't know when it was introduced, but in his book (vol 3) Stroustrup
> seems to imply that it's a new thing. He discusses, for example,
> "transitioning" to it. Now, it seems, its use is compulsory.
> 
> I will not tolerate that either.

1990's tools and techniques are fine, just fine, just not as convenient 
as modern approach. Stick with what you know. However, you'll have to 
adjust some details because compilers now generally conform to the ISO 
standard and not the ARM, e.g. about lifetime of temporaries.


>> descriptions mean - every interpretation I've been able to come up with
>> is something that, as far as I know, either has never been true, or has
>> always been true - either way, there wasn't a change. However, I'm not
>> yet fully up-to-date on anything more recent than C++98. I'm fairly
>> up-to-date on C++2003, and understand many of the more recently added
>> features well enough to make use of them.
> 
> I'd rather put that learning curve into designing and implementing
> a well-thought-out language.
> 
>>> I suppose I should confess that the bugs in C(++) are also part of my
>>> problem with C++. They are the defective string definition in C, and
>>> the defective post-increment semenatic of C++.
>>
>> Could you identify what you consider to be defective about C++'s
>> post-increment semantic?
> 
> It doesn't work with non-native types.
> Post-decrement too, of course.

You just have to defined custom operators where you want custom 
operators and then, if properly defined, they work fine.

The post- operators take a dummy `int` argument, just to distinguish them.

Here's an example:


#include <iostream>
using namespace std;        // Do this to get roughly pre-standard behavior.

struct Non_native
{
     double amount;

     operator double() const { return amount; }

     void advance()
     {
         amount += 0.01;
     }

     Non_native operator++( int )
     {
         Non_native result = *this;
         advance();
         return result;
     }
};

int main()
{
     Non_native o = {3.14};

     cout << "Originally " << o++ << "." << endl;
     cout << "After: " << o << "." << endl;
}


- Alf

Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Help needed Gerry Wolff <gerrywolff65@gmail.com> - 2020-04-03 09:56 -0700
  Re: Help needed Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2020-04-03 18:18 +0100
    Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-03 12:57 -0500
      Re: Help needed Melzzzzz <Melzzzzz@zzzzz.com> - 2020-04-03 18:17 +0000
        Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-03 16:41 -0500
      Re: Help needed James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-04-03 14:58 -0400
        Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-03 16:45 -0500
          Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-03 17:52 -0500
      Re: Help needed Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-04-03 20:05 +0000
        Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-03 16:58 -0500
          Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-03 17:50 -0500
          Re: Help needed James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-04-04 00:15 -0400
            Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-03 23:58 -0500
              Re: Help needed Ian Collins <ian-news@hotmail.com> - 2020-04-04 18:06 +1300
                Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-04 00:35 -0500
                Re: Help needed Ian Collins <ian-news@hotmail.com> - 2020-04-04 19:54 +1300
                Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-04 02:22 -0500
                Re: Help needed Bo Persson <bo@bo-persson.se> - 2020-04-04 10:33 +0200
                Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-04 04:55 -0500
                Re: Help needed David Brown <david.brown@hesbynett.no> - 2020-04-04 13:02 +0200
                Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-04 07:15 -0500
                Re: Help needed David Brown <david.brown@hesbynett.no> - 2020-04-04 16:49 +0200
                Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-05 04:10 -0500
                Re: Help needed Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2020-04-05 16:31 +0100
                Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-05 11:37 -0500
                Re: Help needed Bonita Montero <Bonita.Montero@gmail.com> - 2020-04-04 14:19 +0200
                Re: Help needed David Brown <david.brown@hesbynett.no> - 2020-04-04 16:57 +0200
                Re: Help needed James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-04-04 10:51 -0400
                Re: Help needed James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-04-04 10:44 -0400
                Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-05 04:06 -0500
                Re: Help needed James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-04-05 11:04 -0400
                Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-05 11:31 -0500
                Re: Help needed James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-04-05 16:59 -0400
                Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-05 21:38 -0500
              Re: Help needed "Alf P. Steinbach" <alf.p.steinbach+usenet@gmail.com> - 2020-04-04 13:51 +0200
                Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-04 08:33 -0500
                Re: Help needed Ian Collins <ian-news@hotmail.com> - 2020-04-05 07:35 +1200
                Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-05 04:19 -0500
                Re: Help needed James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-04-05 11:27 -0400
                Re: Help needed James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-04-04 22:27 -0400
                Re: Help needed Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2020-04-04 14:50 +0100
              Re: Help needed James Kuyper <jameskuyper@alumni.caltech.edu> - 2020-04-04 10:27 -0400
                Re: Help needed Ian Collins <ian-news@hotmail.com> - 2020-04-05 07:37 +1200
                Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-05 03:45 -0500
          Re: Help needed Paavo Helde <myfirstname@osa.pri.ee> - 2020-04-04 09:02 +0300
            Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-04 01:20 -0500
              Re: Help needed Ian Collins <ian-news@hotmail.com> - 2020-04-04 19:43 +1300
                Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-04 02:10 -0500
                Re: Help needed Keith Thompson <Keith.S.Thompson+u@gmail.com> - 2020-04-04 01:58 -0700
                Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-04 05:04 -0500
                Re: Help needed Paavo Helde <myfirstname@osa.pri.ee> - 2020-04-04 14:37 +0300
                Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-04 07:25 -0500
                Re: Help needed Paavo Helde <eesnimi@osa.pri.ee> - 2020-04-04 17:39 +0300
                Re: Help needed Ned Latham <nedlatham@woden.valhalla.oz> - 2020-04-05 04:02 -0500
  Re: Help needed Bonita Montero <Bonita.Montero@gmail.com> - 2020-04-03 19:35 +0200
    Re: Help needed Bonita Montero <Bonita.Montero@gmail.com> - 2020-04-03 20:01 +0200
      Re: Help needed Bonita Montero <Bonita.Montero@gmail.com> - 2020-04-04 16:16 +0200
        Re: Help needed Bonita Montero <Bonita.Montero@gmail.com> - 2020-04-04 18:58 +0200
    Re: Help needed Christian Gollwitzer <auriocus@gmx.de> - 2020-04-03 22:01 +0200
      Re: Help needed Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2020-04-03 21:05 +0100
        Re: Help needed Bo Persson <bo@bo-persson.se> - 2020-04-04 02:10 +0200
      Re: Help needed Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-04-04 08:19 +0000
      Re: Help needed Gerry Wolff <gerrywolff65@gmail.com> - 2020-04-05 02:56 -0700
    Re: Help needed Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-04-04 01:14 +0100
    Re: Help needed Gerry Wolff <gerrywolff65@gmail.com> - 2020-04-05 02:49 -0700
  Re: Help needed Sam <sam@email-scan.com> - 2020-04-04 16:30 -0400
    Re: Help needed Mr Flibble <flibbleREMOVETHISBIT@i42.co.uk> - 2020-04-05 05:58 +0100
    Re: Help needed Gerry Wolff <gerrywolff65@gmail.com> - 2020-04-05 03:21 -0700
      Re: Help needed Juha Nieminen <nospam@thanks.invalid> - 2020-04-07 06:33 +0000
        Re: Help needed Jorgen Grahn <grahn+nntp@snipabacken.se> - 2020-04-07 10:39 +0000

csiph-web