[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Use `strsave()`, not `strdup()`.

From: James K. Lowden
Subject: Re: Use `strsave()`, not `strdup()`.
Date: Sun, 14 Nov 2021 16:47:51 -0500

On Tue, 9 Nov 2021 20:17:56 +1100
"G. Branden Robinson" <> wrote:

> We can either:
> * Use a nonstandard allocator; or
> * Handle exceptions.

Hi Brandon, 

If it's C++, you have only one choice: handle exceptions.  Otherwise,
you're using so little of the language that you might as well use C.  

        class F {
                F( int size ) { ... }

        F foo(10);

How does F indictate a failure in its contructor, if not by throwing an
exception?  Are you going to guarantee no constructor throws an
exception, or never use constructors (amost the same thing)?  

The notion of using some acceptable subset of C++ strikes me as quaint
in 2021.  C++ was a controversial language back when compiled languages
could be controversial, but that hasn't been true since Javascript ate
the operating system.  

There was a time, 15 or more years ago, when gcc's C++ implementation
was sub-par.  It choked on valid templates and a variety of
valid-but-complex constructions I threw at it.  In those days I
routinely found errors in Microsoft's implementation, too, about once a

But those days are history.  C++ implementations are up to snuff now,
and groff would be mistaken not to lean on the compilers for what they
can do, and for what the language can deliver. 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]