Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

"If truth is beauty, how come no one has their hair done in the library?" -- Lily Tomlin


devel / comp.lang.c++ / Ain't that beautiful ?

SubjectAuthor
* Ain't that beautiful ?Bonita Montero
`* Re: Ain't that beautiful ?Michael S
 +* Re: Ain't that beautiful ?Sam
 |`* Re: Ain't that beautiful ?Scott Lurndal
 | `* Re: Ain't that beautiful ?Michael S
 |  `* Re: Ain't that beautiful ?Bonita Montero
 |   `* Re: Ain't that beautiful ?Michael S
 |    `* Re: Ain't that beautiful ?Bonita Montero
 |     `* Re: Ain't that beautiful ?Chris M. Thomasson
 |      `* Re: Ain't that beautiful ?Bonita Montero
 |       `* Re: Ain't that beautiful ?Scott Lurndal
 |        `* Re: Ain't that beautiful ?Bonita Montero
 |         `- Re: Ain't that beautiful ?Chris M. Thomasson
 `* Re: Ain't that beautiful ?Bonita Montero
  `* Re: Ain't that beautiful ?Michael S
   `* Re: Ain't that beautiful ?Bonita Montero
    `* Re: Ain't that beautiful ?Scott Lurndal
     `* Re: Ain't that beautiful ?Bonita Montero
      `* Re: Ain't that beautiful ?Scott Lurndal
       +- Re: Ain't that beautiful ?Bonita Montero
       `* Re: Ain't that beautiful ?Paavo Helde
        +* Re: Ain't that beautiful ?Scott Lurndal
        |+* Re: Ain't that beautiful ?Bonita Montero
        ||`* Re: Ain't that beautiful ?wij
        || `* Re: Ain't that beautiful ?Bonita Montero
        ||  `- Re: Ain't that beautiful ?wij
        |`- Re: Ain't that beautiful ?Michael S
        `* Re: Ain't that beautiful ?Michael S
         +* Re: Ain't that beautiful ?David Brown
         |+* Re: Ain't that beautiful ?Michael S
         ||+- Re: Ain't that beautiful ?Scott Lurndal
         ||+- Re: Ain't that beautiful ?David Brown
         ||`- Re: Ain't that beautiful ?Bonita Montero
         |`* std::map advocacyMichael S
         | +* Re: std::map advocacyDavid Brown
         | |`* Re: std::map advocacyMichael S
         | | `* Re: std::map advocacyDavid Brown
         | |  +* Re: std::map advocacyMichael S
         | |  |+* Re: std::map advocacywij
         | |  ||`* Re: std::map advocacyMichael S
         | |  || `* Re: std::map advocacywij
         | |  ||  `* Re: std::map advocacyMichael S
         | |  ||   `- Re: std::map advocacyBonita Montero
         | |  |+- Re: std::map advocacyDavid Brown
         | |  |`* Re: std::map advocacyScott Lurndal
         | |  | `* Re: std::map advocacyMichael S
         | |  |  +* Re: std::map advocacyScott Lurndal
         | |  |  |`* Re: std::map advocacyMichael S
         | |  |  | `- Re: std::map advocacyScott Lurndal
         | |  |  `* Re: std::map advocacyDavid Brown
         | |  |   `* Re: std::map advocacyMichael S
         | |  |    `- Re: std::map advocacyDavid Brown
         | |  `* Re: std::map advocacyRichard Damon
         | |   `* Re: std::map advocacyDavid Brown
         | |    `* Re: std::map advocacyJames Kuyper
         | |     `* Re: std::map advocacyDavid Brown
         | |      `* Re: std::map advocacyMichael S
         | |       `* Re: std::map advocacyDavid Brown
         | |        `* Re: std::map advocacyMichael S
         | |         +- Re: std::map advocacyDavid Brown
         | |         `* Re: std::map advocacyJames Kuyper
         | |          `* Re: std::map advocacyMichael S
         | |           `* Re: std::map advocacyDavid Brown
         | |            `* Re: std::map advocacywij
         | |             +* Re: std::map advocacyDavid Brown
         | |             |+* Re: std::map advocacyBonita Montero
         | |             ||`* Re: std::map advocacyMichael S
         | |             || `* Re: std::map advocacyBonita Montero
         | |             ||  `* Re: std::map advocacyMichael S
         | |             ||   `- Re: std::map advocacyBonita Montero
         | |             |`* Re: std::map advocacywij
         | |             | `- Re: std::map advocacyDavid Brown
         | |             `* Re: std::map advocacyMichael S
         | |              `- Re: std::map advocacyPaavo Helde
         | +* Re: std::map advocacyScott Lurndal
         | |+* Re: std::map advocacyMichael S
         | ||`- Re: std::map advocacyBonita Montero
         | |`- Re: std::map advocacyPaavo Helde
         | `* Re: std::map advocacyBonita Montero
         |  `* Re: std::map advocacyMichael S
         |   `* Re: std::map advocacyBonita Montero
         |    `* Re: std::map advocacyMichael S
         |     `* Re: std::map advocacyBonita Montero
         |      `* Re: std::map advocacyMichael S
         |       +- Re: std::map advocacyMichael S
         |       `- Re: std::map advocacyBonita Montero
         +* Re: Ain't that beautiful ?Bonita Montero
         |`* Re: Ain't that beautiful ?Michael S
         | `- Re: Ain't that beautiful ?Bonita Montero
         `- Re: Ain't that beautiful ?Paavo Helde

Pages:1234
Ain't that beautiful ?

<uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3485&group=comp.lang.c%2B%2B#3485

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Ain't that beautiful ?
Date: Thu, 4 Apr 2024 20:11:10 +0200
Organization: A noiseless patient Spider
Lines: 44
Message-ID: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 04 Apr 2024 18:11:07 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="0ec1ec35ea90d688bed0749b5105a8e4";
logging-data="858912"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19sU2i2LmYzvLAG38Kf2NWn8TH5hmlvDWg="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:IMq2WDv5vLY55csmGb5FPjAx1aQ=
Content-Language: de-DE
 by: Bonita Montero - Thu, 4 Apr 2024 18:11 UTC

template<bool Throw = false>
std::conditional_t<Throw, void, DWORD> getFileTime( wchar_t const *file,
FILETIME &ftCreationTime, FILETIME &ftLastAccessTime, FILETIME
&ftLastWriteTime )
{ XHANDLE xhFile( CreateFileW( file, FILE_READ_ATTRIBUTES,
FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS, NULL ) );
if( xhFile == INVALID_HANDLE_VALUE )
if constexpr( Throw )
throwSysErr( "can't open file to get file time" );
else
return GetLastError();
if( !GetFileTime( xhFile, &ftCreationTime, &ftLastAccessTime,
&ftLastWriteTime ) )
if constexpr( Throw )
throwSysErr( "can't get file time" );
else
return GetLastError();
return NO_ERROR;
}

template<bool Throw = false>
std::conditional_t<Throw, void, DWORD> setFileTime( wchar_t const *file,
FILETIME const &ftCreationTime, FILETIME const &ftLastAccessTime,
FILETIME const &ftLastWriteTime )
{ XHANDLE xhFile( CreateFileW( file, FILE_WRITE_ATTRIBUTES,
FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING,
FILE_FLAG_BACKUP_SEMANTICS, NULL ) );
if( xhFile == INVALID_HANDLE_VALUE )
if constexpr( Throw )
throwSysErr( "can't open file to set file time" );
else
return GetLastError();
if( !SetFileTime( xhFile, &ftCreationTime, &ftLastAccessTime,
&ftLastWriteTime ) )
if constexpr( Throw )
throwSysErr( "can't set file time" );
else
return GetLastError();
return NO_ERROR;
}

Re: Ain't that beautiful ?

<20240404215534.0000623d@yahoo.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3486&group=comp.lang.c%2B%2B#3486

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5...@yahoo.com (Michael S)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Thu, 4 Apr 2024 21:55:34 +0300
Organization: A noiseless patient Spider
Lines: 68
Message-ID: <20240404215534.0000623d@yahoo.com>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Thu, 04 Apr 2024 18:55:38 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="3c4c4a494315ce62f6b780487464cc51";
logging-data="871521"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19vzOXo+47lh8ebBLG5isrOx0s7imyoPb8="
Cancel-Lock: sha1:6KV3vkXNpj7iYbUPrTlQUu4mybE=
X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)
 by: Michael S - Thu, 4 Apr 2024 18:55 UTC

On Thu, 4 Apr 2024 20:11:10 +0200
Bonita Montero <Bonita.Montero@gmail.com> wrote:

> template<bool Throw = false>
> std::conditional_t<Throw, void, DWORD> getFileTime( wchar_t const
> *file, FILETIME &ftCreationTime, FILETIME &ftLastAccessTime, FILETIME
> &ftLastWriteTime )
> {
> XHANDLE xhFile( CreateFileW( file, FILE_READ_ATTRIBUTES,
> FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING,
> FILE_FLAG_BACKUP_SEMANTICS, NULL ) );
> if( xhFile == INVALID_HANDLE_VALUE )
> if constexpr( Throw )
> throwSysErr( "can't open file to get file
> time" ); else
> return GetLastError();
> if( !GetFileTime( xhFile, &ftCreationTime, &ftLastAccessTime,
> &ftLastWriteTime ) )
> if constexpr( Throw )
> throwSysErr( "can't get file time" );
> else
> return GetLastError();
> return NO_ERROR;
> }
>
> template<bool Throw = false>
> std::conditional_t<Throw, void, DWORD> setFileTime( wchar_t const
> *file, FILETIME const &ftCreationTime, FILETIME const
> &ftLastAccessTime, FILETIME const &ftLastWriteTime )
> {
> XHANDLE xhFile( CreateFileW( file, FILE_WRITE_ATTRIBUTES,
> FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING,
> FILE_FLAG_BACKUP_SEMANTICS, NULL ) );
> if( xhFile == INVALID_HANDLE_VALUE )
> if constexpr( Throw )
> throwSysErr( "can't open file to set file
> time" ); else
> return GetLastError();
> if( !SetFileTime( xhFile, &ftCreationTime, &ftLastAccessTime,
> &ftLastWriteTime ) )
> if constexpr( Throw )
> throwSysErr( "can't set file time" );
> else
> return GetLastError();
> return NO_ERROR;
> }
>

No, it is not beautiful. It is not even half-decent.
Personally, I find all exceptions ugly, but that can be considered
my personal idiosyncrasy, even if it is shared by significant percentage
of C++ programmers.
However, reporting non-exceptional situation with exceptions is
non-controversially bad design.
Is is listed high on "Don't do it" list in one of the books in Scott
Meyers's "Effective C++" series.
If you wonder why, it's not related to performance.

And not being able to open file is most certainly *not* an exceptional
situation!

Re: Ain't that beautiful ?

<cone.1712275227.292802.483430.1004@monster.email-scan.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3487&group=comp.lang.c%2B%2B#3487

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: sam...@email-scan.com (Sam)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Thu, 04 Apr 2024 20:00:27 -0400
Organization: A noiseless patient Spider
Lines: 56
Message-ID: <cone.1712275227.292802.483430.1004@monster.email-scan.com>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org> <20240404215534.0000623d@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; delsp=yes; charset="UTF-8"
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 05 Apr 2024 00:00:27 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="0f7b57fecbecee245d99e28c1c3c851f";
logging-data="1013239"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/mIlwvbZsYQYVMJfl9sb7e"
Cancel-Lock: sha1:naeW8WpaarFEyeRKrDa/1gsVwjg=
X-Shameless-Plug: https://github.com/svarshavchik
X-Mailer: https://www.courier-mta.org/cone/
Content-Disposition: inline
 by: Sam - Fri, 5 Apr 2024 00:00 UTC

Michael S writes:

> On Thu, 4 Apr 2024 20:11:10 +0200
> Bonita Montero <Bonita.Montero@gmail.com> wrote:
>
> > template<bool Throw = false>
> > std::conditional_t<Throw, void, DWORD> getFileTime( wchar_t const
> > *file, FILETIME &ftCreationTime, FILETIME &ftLastAccessTime, FILETIME
> > &ftLastWriteTime )
> > {
> > XHANDLE xhFile( CreateFileW( file, FILE_READ_ATTRIBUTES,
> > FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING,
> > FILE_FLAG_BACKUP_SEMANTICS, NULL ) );
> > if( xhFile == INVALID_HANDLE_VALUE )
> > if constexpr( Throw )
> > throwSysErr( "can't open file to get file
> > time" ); else
> > return GetLastError();
> > if( !GetFileTime( xhFile, &ftCreationTime, &ftLastAccessTime,
> > &ftLastWriteTime ) )
> > if constexpr( Throw )
> > throwSysErr( "can't get file time" );
> > else
> > return GetLastError();
> > return NO_ERROR;
> > }
> >
> > template<bool Throw = false>
> > std::conditional_t<Throw, void, DWORD> setFileTime( wchar_t const
> > *file, FILETIME const &ftCreationTime, FILETIME const
> > &ftLastAccessTime, FILETIME const &ftLastWriteTime )
> > {
> > XHANDLE xhFile( CreateFileW( file, FILE_WRITE_ATTRIBUTES,
> > FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING,
> > FILE_FLAG_BACKUP_SEMANTICS, NULL ) );
> > if( xhFile == INVALID_HANDLE_VALUE )
> > if constexpr( Throw )
> > throwSysErr( "can't open file to set file
> > time" ); else
> > return GetLastError();
> > if( !SetFileTime( xhFile, &ftCreationTime, &ftLastAccessTime,
> > &ftLastWriteTime ) )
> > if constexpr( Throw )
> > throwSysErr( "can't set file time" );
> > else
> > return GetLastError();
> > return NO_ERROR;
> > }
> >
>
>
> No, it is not beautiful. It is not even half-decent.

Agreed. This looks like something I scraped off the bottom of my shoe,
yesterday.

Re: Ain't that beautiful ?

<CuHPN.189578$taff.30721@fx41.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3488&group=comp.lang.c%2B%2B#3488

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx41.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Ain't that beautiful ?
Newsgroups: comp.lang.c++
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org> <20240404215534.0000623d@yahoo.com> <cone.1712275227.292802.483430.1004@monster.email-scan.com>
Lines: 75
Message-ID: <CuHPN.189578$taff.30721@fx41.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Fri, 05 Apr 2024 00:21:54 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Fri, 05 Apr 2024 00:21:54 GMT
X-Received-Bytes: 3111
 by: Scott Lurndal - Fri, 5 Apr 2024 00:21 UTC

Sam <sam@email-scan.com> writes:
>Michael S writes:
>
>> On Thu, 4 Apr 2024 20:11:10 +0200
>> Bonita Montero <Bonita.Montero@gmail.com> wrote:
>>
>> > template<bool Throw = false>
>> > std::conditional_t<Throw, void, DWORD> getFileTime( wchar_t const
>> > *file, FILETIME &ftCreationTime, FILETIME &ftLastAccessTime, FILETIME
>> > &ftLastWriteTime )
>> > {
>> > XHANDLE xhFile( CreateFileW( file, FILE_READ_ATTRIBUTES,
>> > FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING,
>> > FILE_FLAG_BACKUP_SEMANTICS, NULL ) );
>> > if( xhFile == INVALID_HANDLE_VALUE )
>> > if constexpr( Throw )
>> > throwSysErr( "can't open file to get file
>> > time" ); else
>> > return GetLastError();
>> > if( !GetFileTime( xhFile, &ftCreationTime, &ftLastAccessTime,
>> > &ftLastWriteTime ) )
>> > if constexpr( Throw )
>> > throwSysErr( "can't get file time" );
>> > else
>> > return GetLastError();
>> > return NO_ERROR;
>> > }
>> >
>> > template<bool Throw = false>
>> > std::conditional_t<Throw, void, DWORD> setFileTime( wchar_t const
>> > *file, FILETIME const &ftCreationTime, FILETIME const
>> > &ftLastAccessTime, FILETIME const &ftLastWriteTime )
>> > {
>> > XHANDLE xhFile( CreateFileW( file, FILE_WRITE_ATTRIBUTES,
>> > FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING,
>> > FILE_FLAG_BACKUP_SEMANTICS, NULL ) );
>> > if( xhFile == INVALID_HANDLE_VALUE )
>> > if constexpr( Throw )
>> > throwSysErr( "can't open file to set file
>> > time" ); else
>> > return GetLastError();
>> > if( !SetFileTime( xhFile, &ftCreationTime, &ftLastAccessTime,
>> > &ftLastWriteTime ) )
>> > if constexpr( Throw )
>> > throwSysErr( "can't set file time" );
>> > else
>> > return GetLastError();
>> > return NO_ERROR;
>> > }
>> >
>>
>>
>> No, it is not beautiful. It is not even half-decent.
>
>Agreed. This looks like something I scraped off the bottom of my shoe,
>yesterday.
>

Concur. It appears to leak file handles as well.

int
set_filetime(const char *path, struct timespec access_time, struct timespec modify_time, int&
fd)
{ fd = open(path, O_RDWR|O_CREAT|O_EXCL, 0066);
if (fd != -1) {
struct timespec times[2] = { access_time, modify_time };
if (futimens(fd, times) == 0) {
(void) close(fd);
fd = -1;
}
return fd;
}
return errno;
}

Re: Ain't that beautiful ?

<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3490&group=comp.lang.c%2B%2B#3490

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Fri, 5 Apr 2024 05:05:40 +0200
Organization: A noiseless patient Spider
Lines: 73
Message-ID: <uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 05 Apr 2024 03:05:37 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="6cf46502720c034509343f89289013c9";
logging-data="1209657"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19HDhc4IJDboIj0GD4nGDTowPO8mA6cJX4="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:XQ+AAERbXclJHqDmS/kBenMPW+w=
In-Reply-To: <20240404215534.0000623d@yahoo.com>
Content-Language: de-DE
 by: Bonita Montero - Fri, 5 Apr 2024 03:05 UTC

Am 04.04.2024 um 20:55 schrieb Michael S:
> On Thu, 4 Apr 2024 20:11:10 +0200
> Bonita Montero <Bonita.Montero@gmail.com> wrote:
>
>> template<bool Throw = false>
>> std::conditional_t<Throw, void, DWORD> getFileTime( wchar_t const
>> *file, FILETIME &ftCreationTime, FILETIME &ftLastAccessTime, FILETIME
>> &ftLastWriteTime )
>> {
>> XHANDLE xhFile( CreateFileW( file, FILE_READ_ATTRIBUTES,
>> FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING,
>> FILE_FLAG_BACKUP_SEMANTICS, NULL ) );
>> if( xhFile == INVALID_HANDLE_VALUE )
>> if constexpr( Throw )
>> throwSysErr( "can't open file to get file
>> time" ); else
>> return GetLastError();
>> if( !GetFileTime( xhFile, &ftCreationTime, &ftLastAccessTime,
>> &ftLastWriteTime ) )
>> if constexpr( Throw )
>> throwSysErr( "can't get file time" );
>> else
>> return GetLastError();
>> return NO_ERROR;
>> }
>>
>> template<bool Throw = false>
>> std::conditional_t<Throw, void, DWORD> setFileTime( wchar_t const
>> *file, FILETIME const &ftCreationTime, FILETIME const
>> &ftLastAccessTime, FILETIME const &ftLastWriteTime )
>> {
>> XHANDLE xhFile( CreateFileW( file, FILE_WRITE_ATTRIBUTES,
>> FILE_SHARE_READ | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING,
>> FILE_FLAG_BACKUP_SEMANTICS, NULL ) );
>> if( xhFile == INVALID_HANDLE_VALUE )
>> if constexpr( Throw )
>> throwSysErr( "can't open file to set file
>> time" ); else
>> return GetLastError();
>> if( !SetFileTime( xhFile, &ftCreationTime, &ftLastAccessTime,
>> &ftLastWriteTime ) )
>> if constexpr( Throw )
>> throwSysErr( "can't set file time" );
>> else
>> return GetLastError();
>> return NO_ERROR;
>> }
>>
>
>
> No, it is not beautiful. It is not even half-decent.
> Personally, I find all exceptions ugly, but that can be considered
> my personal idiosyncrasy, even if it is shared by significant percentage
> of C++ programmers.

I just thought that sometimes I want the error code for the direct
caller and sometimes I want an exception that applies to the caller
a few levels higher, and so I can have both.
I don't find exceptions ugly at all, but rather very elegant.
For me, exceptions are the most convenient way of handling errors.

> However, reporting non-exceptional situation with exceptions is
> non-controversially bad design.

You can't say that, or in the given case it may be that the error has
to be acted upon by your immediate caller or just a few levels higher
in the call graph; In the latter case, exceptions make sense.

> And not being able to open file is most certainly *not* an exceptional
> situation!

You can't say that across the board.

Re: Ain't that beautiful ?

<20240405174448.00001e50@yahoo.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3491&group=comp.lang.c%2B%2B#3491

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5...@yahoo.com (Michael S)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Fri, 5 Apr 2024 17:44:48 +0300
Organization: A noiseless patient Spider
Lines: 14
Message-ID: <20240405174448.00001e50@yahoo.com>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<cone.1712275227.292802.483430.1004@monster.email-scan.com>
<CuHPN.189578$taff.30721@fx41.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 05 Apr 2024 14:44:53 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7aa75bcf4641487361ea6e6c636dc768";
logging-data="1495609"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1838IIjOLNxm1MfAh3+xebBLkYv7TfhaIw="
Cancel-Lock: sha1:BESZ831zJPAUMJCQxn+EU0YpuhM=
X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)
 by: Michael S - Fri, 5 Apr 2024 14:44 UTC

On Fri, 05 Apr 2024 00:21:54 GMT
scott@slp53.sl.home (Scott Lurndal) wrote:

>
> Concur. It appears to leak file handles as well.
>

Actually, we don't know, because Bonita did not show us a definition of
XHANDLE. It could be an object that prevent handle leaks by means of
RAII.
I'd give her (or him) the benefit of doubt.

Re: Ain't that beautiful ?

<20240405175257.000066a0@yahoo.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3492&group=comp.lang.c%2B%2B#3492

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5...@yahoo.com (Michael S)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Fri, 5 Apr 2024 17:52:57 +0300
Organization: A noiseless patient Spider
Lines: 35
Message-ID: <20240405175257.000066a0@yahoo.com>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 05 Apr 2024 14:53:02 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7aa75bcf4641487361ea6e6c636dc768";
logging-data="1495609"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+oGsk/8ZXEqyqxiyUlADs0NNcWsUR4I3s="
Cancel-Lock: sha1:BVT0OC29XTBtyNEvoofIHztnw9I=
X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)
 by: Michael S - Fri, 5 Apr 2024 14:52 UTC

On Fri, 5 Apr 2024 05:05:40 +0200
Bonita Montero <Bonita.Montero@gmail.com> wrote:

> Am 04.04.2024 um 20:55 schrieb Michael S:
> > On Thu, 4 Apr 2024 20:11:10 +0200
>
> I just thought that sometimes I want the error code for the direct
> caller and sometimes I want an exception that applies to the caller
> a few levels higher, and so I can have both.
> I don't find exceptions ugly at all, but rather very elegant.
> For me, exceptions are the most convenient way of handling errors.
>

You're not alone. Nor am I.

> > However, reporting non-exceptional situation with exceptions is
> > non-controversially bad design.
>
> You can't say that, or in the given case it may be that the error has
> to be acted upon by your immediate caller or just a few levels higher
> in the call graph; In the latter case, exceptions make sense.
>

You're still not alone, unfortunately.
The computing world would be better place if your kind knew better.

> > And not being able to open file is most certainly *not* an
> > exceptional situation!
>
> You can't say that across the board.
>

Your template supposed to be provided as generic utility, right?
So in order to be correct I don't have to be correct accros the board.

Re: Ain't that beautiful ?

<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3493&group=comp.lang.c%2B%2B#3493

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Fri, 5 Apr 2024 17:26:07 +0200
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 05 Apr 2024 15:26:04 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="6cf46502720c034509343f89289013c9";
logging-data="1536963"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/fJ0axLnQwkYZ8d0EfPMY/yZrRSDQPnB8="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:tkvT3ktDz9YyT0DW99Sc/t1BhRg=
In-Reply-To: <20240405175257.000066a0@yahoo.com>
Content-Language: de-DE
 by: Bonita Montero - Fri, 5 Apr 2024 15:26 UTC

Am 05.04.2024 um 16:52 schrieb Michael S:
> On Fri, 5 Apr 2024 05:05:40 +0200
> Bonita Montero <Bonita.Montero@gmail.com> wrote:
>
>> Am 04.04.2024 um 20:55 schrieb Michael S:
>>> On Thu, 4 Apr 2024 20:11:10 +0200
>>
>> I just thought that sometimes I want the error code for the direct
>> caller and sometimes I want an exception that applies to the caller
>> a few levels higher, and so I can have both.
>> I don't find exceptions ugly at all, but rather very elegant.
>> For me, exceptions are the most convenient way of handling errors.
>>
>
> You're not alone. Nor am I.

It's impossible to use C++ without exception. The standard library
can thow bad_alloc(), system_error() from a lot of places and if
you use C++ you must handle these exceptions.

> Your template supposed to be provided as generic utility, right?

In some cases the immediate caller needs the error code and in other
cases you would pass the exceptions a few call levels higher; my code
can handle both.

Re: Ain't that beautiful ?

<uup59h$1esu3$2@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3494&group=comp.lang.c%2B%2B#3494

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Fri, 5 Apr 2024 17:27:49 +0200
Organization: A noiseless patient Spider
Lines: 18
Message-ID: <uup59h$1esu3$2@raubtier-asyl.eternal-september.org>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<cone.1712275227.292802.483430.1004@monster.email-scan.com>
<CuHPN.189578$taff.30721@fx41.iad> <20240405174448.00001e50@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 05 Apr 2024 15:27:45 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="6cf46502720c034509343f89289013c9";
logging-data="1536963"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18OkG2AUHoy7Kx4sGtQtHF7V7a7E40p0oI="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:AK5bwJLbFNTSYwaxEntA87a44CU=
Content-Language: de-DE
In-Reply-To: <20240405174448.00001e50@yahoo.com>
 by: Bonita Montero - Fri, 5 Apr 2024 15:27 UTC

Am 05.04.2024 um 16:44 schrieb Michael S:
> On Fri, 05 Apr 2024 00:21:54 GMT
> scott@slp53.sl.home (Scott Lurndal) wrote:
>
>>
>> Concur. It appears to leak file handles as well.
>>
>
> Actually, we don't know, because Bonita did not show us a definition of
> XHANDLE. It could be an object that prevent handle leaks by means of
> RAII.
> I'd give her (or him) the benefit of doubt.
>
>
>

If you knew Win32 you would know that XHANDLE is a RAII wrapper
for HANDLE.

Re: Ain't that beautiful ?

<20240405183723.0000585f@yahoo.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3495&group=comp.lang.c%2B%2B#3495

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5...@yahoo.com (Michael S)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Fri, 5 Apr 2024 18:37:23 +0300
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <20240405183723.0000585f@yahoo.com>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<cone.1712275227.292802.483430.1004@monster.email-scan.com>
<CuHPN.189578$taff.30721@fx41.iad>
<20240405174448.00001e50@yahoo.com>
<uup59h$1esu3$2@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 05 Apr 2024 15:37:28 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7aa75bcf4641487361ea6e6c636dc768";
logging-data="1495609"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/jOM8fMryJfg19YM6YM0PjCGEqLM3skKk="
Cancel-Lock: sha1:qpj2b4BO4/tQtsl6g3yDwfkFDVw=
X-Newsreader: Claws Mail 4.1.1 (GTK 3.24.34; x86_64-w64-mingw32)
 by: Michael S - Fri, 5 Apr 2024 15:37 UTC

On Fri, 5 Apr 2024 17:27:49 +0200
Bonita Montero <Bonita.Montero@gmail.com> wrote:

> Am 05.04.2024 um 16:44 schrieb Michael S:
> > On Fri, 05 Apr 2024 00:21:54 GMT
> > scott@slp53.sl.home (Scott Lurndal) wrote:
> >
> >>
> >> Concur. It appears to leak file handles as well.
> >>
> >
> > Actually, we don't know, because Bonita did not show us a
> > definition of XHANDLE. It could be an object that prevent handle
> > leaks by means of RAII.
> > I'd give her (or him) the benefit of doubt.
> >
> >
> >
>
> If you knew Win32 you would know that XHANDLE is a RAII wrapper
> for HANDLE.

I would think that nowadays even Dave Cutler does not know all Win32.
However I know enough to know that Win32 is defined in terms of C.
So I don't quite understand how XHANDLE can be part of it.
Anyway, it seems I guessed the meaning correctly.

Re: Ain't that beautiful ?

<uup7dg$1febk$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3496&group=comp.lang.c%2B%2B#3496

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Fri, 5 Apr 2024 18:04:03 +0200
Organization: A noiseless patient Spider
Lines: 7
Message-ID: <uup7dg$1febk$1@raubtier-asyl.eternal-september.org>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<cone.1712275227.292802.483430.1004@monster.email-scan.com>
<CuHPN.189578$taff.30721@fx41.iad> <20240405174448.00001e50@yahoo.com>
<uup59h$1esu3$2@raubtier-asyl.eternal-september.org>
<20240405183723.0000585f@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 05 Apr 2024 16:04:00 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="6cf46502720c034509343f89289013c9";
logging-data="1554804"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18cOArPAYu6oC+CrG5JxFHP1esJZj8j/9w="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:L/QAq16LwQ5/fTND2B2SrX3UqR0=
In-Reply-To: <20240405183723.0000585f@yahoo.com>
Content-Language: de-DE
 by: Bonita Montero - Fri, 5 Apr 2024 16:04 UTC

Am 05.04.2024 um 17:37 schrieb Michael S:

> However I know enough to know that Win32 is defined in terms of C.
> So I don't quite understand how XHANDLE can be part of it.

It's obvious.

Re: Ain't that beautiful ?

<GLYPN.6$zaCc.4@fx08.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3497&group=comp.lang.c%2B%2B#3497

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!193.141.40.65.MISMATCH!npeer.as286.net!npeer-ng0.as286.net!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx08.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Ain't that beautiful ?
Newsgroups: comp.lang.c++
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org> <20240404215534.0000623d@yahoo.com> <uunpq1$14t9p$1@raubtier-asyl.eternal-september.org> <20240405175257.000066a0@yahoo.com> <uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
Lines: 20
Message-ID: <GLYPN.6$zaCc.4@fx08.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Fri, 05 Apr 2024 20:00:38 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Fri, 05 Apr 2024 20:00:38 GMT
X-Received-Bytes: 1603
 by: Scott Lurndal - Fri, 5 Apr 2024 20:00 UTC

Bonita Montero <Bonita.Montero@gmail.com> writes:
>Am 05.04.2024 um 16:52 schrieb Michael S:
>> On Fri, 5 Apr 2024 05:05:40 +0200
>> Bonita Montero <Bonita.Montero@gmail.com> wrote:
>>
>>> Am 04.04.2024 um 20:55 schrieb Michael S:
>>>> On Thu, 4 Apr 2024 20:11:10 +0200
>>>
>>> I just thought that sometimes I want the error code for the direct
>>> caller and sometimes I want an exception that applies to the caller
>>> a few levels higher, and so I can have both.
>>> I don't find exceptions ugly at all, but rather very elegant.
>>> For me, exceptions are the most convenient way of handling errors.
>>>
>>
>> You're not alone. Nor am I.
>
>It's impossible to use C++ without exception.

It is quite possible. Don't use the standard library.

Re: Ain't that beautiful ?

<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3498&group=comp.lang.c%2B%2B#3498

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Fri, 5 Apr 2024 22:29:55 +0200
Organization: A noiseless patient Spider
Lines: 24
Message-ID: <uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Fri, 05 Apr 2024 20:29:52 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="6cf46502720c034509343f89289013c9";
logging-data="1680282"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+3y5DoMh+qCQeeJhI5OaugYQRGpSlUXHM="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:freNswjP3vHvJ5+PbhdjSVUuAcU=
In-Reply-To: <GLYPN.6$zaCc.4@fx08.iad>
Content-Language: de-DE
 by: Bonita Montero - Fri, 5 Apr 2024 20:29 UTC

Am 05.04.2024 um 22:00 schrieb Scott Lurndal:
> Bonita Montero <Bonita.Montero@gmail.com> writes:
>> Am 05.04.2024 um 16:52 schrieb Michael S:
>>> On Fri, 5 Apr 2024 05:05:40 +0200
>>> Bonita Montero <Bonita.Montero@gmail.com> wrote:
>>>
>>>> Am 04.04.2024 um 20:55 schrieb Michael S:
>>>>> On Thu, 4 Apr 2024 20:11:10 +0200
>>>>
>>>> I just thought that sometimes I want the error code for the direct
>>>> caller and sometimes I want an exception that applies to the caller
>>>> a few levels higher, and so I can have both.
>>>> I don't find exceptions ugly at all, but rather very elegant.
>>>> For me, exceptions are the most convenient way of handling errors.
>>>>
>>>
>>> You're not alone. Nor am I.
>>
>> It's impossible to use C++ without exception.
>
> It is quite possible. Don't use the standard library.

Then you're missing most of C++.

Re: Ain't that beautiful ?

<03_PN.124502$U1cc.11575@fx04.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3499&group=comp.lang.c%2B%2B#3499

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1-2.proxad.net!proxad.net!feeder1-1.proxad.net!193.141.40.65.MISMATCH!npeer.as286.net!npeer-ng0.as286.net!peer02.ams1!peer.ams1.xlned.com!news.xlned.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx04.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Ain't that beautiful ?
Newsgroups: comp.lang.c++
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org> <20240404215534.0000623d@yahoo.com> <uunpq1$14t9p$1@raubtier-asyl.eternal-september.org> <20240405175257.000066a0@yahoo.com> <uup56c$1esu3$1@raubtier-asyl.eternal-september.org> <GLYPN.6$zaCc.4@fx08.iad> <uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
Lines: 31
Message-ID: <03_PN.124502$U1cc.11575@fx04.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Fri, 05 Apr 2024 21:29:32 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Fri, 05 Apr 2024 21:29:32 GMT
X-Received-Bytes: 2006
 by: Scott Lurndal - Fri, 5 Apr 2024 21:29 UTC

Bonita Montero <Bonita.Montero@gmail.com> writes:
>Am 05.04.2024 um 22:00 schrieb Scott Lurndal:
>> Bonita Montero <Bonita.Montero@gmail.com> writes:
>>> Am 05.04.2024 um 16:52 schrieb Michael S:
>>>> On Fri, 5 Apr 2024 05:05:40 +0200
>>>> Bonita Montero <Bonita.Montero@gmail.com> wrote:
>>>>
>>>>> Am 04.04.2024 um 20:55 schrieb Michael S:
>>>>>> On Thu, 4 Apr 2024 20:11:10 +0200
>>>>>
>>>>> I just thought that sometimes I want the error code for the direct
>>>>> caller and sometimes I want an exception that applies to the caller
>>>>> a few levels higher, and so I can have both.
>>>>> I don't find exceptions ugly at all, but rather very elegant.
>>>>> For me, exceptions are the most convenient way of handling errors.
>>>>>
>>>>
>>>> You're not alone. Nor am I.
>>>
>>> It's impossible to use C++ without exception.
>>
>> It is quite possible. Don't use the standard library.
>
>Then you're missing most of C++.
>

Most of C++ is useless cruft with a significant run-time
performance hit.

Classes are genuinely useful, as are namespaces.

Re: Ain't that beautiful ?

<uuqsa9$1unv9$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3500&group=comp.lang.c%2B%2B#3500

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Sat, 6 Apr 2024 09:06:53 +0200
Organization: A noiseless patient Spider
Lines: 38
Message-ID: <uuqsa9$1unv9$1@raubtier-asyl.eternal-september.org>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 06 Apr 2024 07:06:50 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="024b50bc71e7b939469fd9a0113587fc";
logging-data="2056169"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19AGKkePZ+jtUoC+DojHLuKblmA9KmjefU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:wfR5V1Xt9Y8WuUTOe8H0GAJLGM8=
Content-Language: de-DE
In-Reply-To: <03_PN.124502$U1cc.11575@fx04.iad>
 by: Bonita Montero - Sat, 6 Apr 2024 07:06 UTC

Am 05.04.2024 um 23:29 schrieb Scott Lurndal:
> Bonita Montero <Bonita.Montero@gmail.com> writes:
>> Am 05.04.2024 um 22:00 schrieb Scott Lurndal:
>>> Bonita Montero <Bonita.Montero@gmail.com> writes:
>>>> Am 05.04.2024 um 16:52 schrieb Michael S:
>>>>> On Fri, 5 Apr 2024 05:05:40 +0200
>>>>> Bonita Montero <Bonita.Montero@gmail.com> wrote:
>>>>>
>>>>>> Am 04.04.2024 um 20:55 schrieb Michael S:
>>>>>>> On Thu, 4 Apr 2024 20:11:10 +0200
>>>>>>
>>>>>> I just thought that sometimes I want the error code for the direct
>>>>>> caller and sometimes I want an exception that applies to the caller
>>>>>> a few levels higher, and so I can have both.
>>>>>> I don't find exceptions ugly at all, but rather very elegant.
>>>>>> For me, exceptions are the most convenient way of handling errors.
>>>>>>
>>>>>
>>>>> You're not alone. Nor am I.
>>>>
>>>> It's impossible to use C++ without exception.
>>>
>>> It is quite possible. Don't use the standard library.
>>
>> Then you're missing most of C++.
>>
>
> Most of C++ is useless cruft with a significant run-time
> performance hit.

That's not true. Nearly all C++ features don't have
an additional performance hit.

> Classes are genuinely useful, as are namespaces.

You're a simple mind.

Re: Ain't that beautiful ?

<uurm8q$24ka4$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3501&group=comp.lang.c%2B%2B#3501

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: eesn...@osa.pri.ee (Paavo Helde)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Sat, 6 Apr 2024 17:29:45 +0300
Organization: A noiseless patient Spider
Lines: 26
Message-ID: <uurm8q$24ka4$1@dont-email.me>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 06 Apr 2024 14:29:47 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="57195cfd9cbb39d5531352ae982fab59";
logging-data="2249028"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18gj8t654Ab8dibj5MOvlJkAFytoc+LfIU="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:IKvmgYSYTQsTmOLgTNGPdBdVR8w=
In-Reply-To: <03_PN.124502$U1cc.11575@fx04.iad>
Content-Language: en-US
 by: Paavo Helde - Sat, 6 Apr 2024 14:29 UTC

06.04.2024 00:29 Scott Lurndal kirjutas:
>
> Most of C++ is useless cruft with a significant run-time
> performance hit.
>
> Classes are genuinely useful, as are namespaces.

So are standard containers, like std::vector and std::map. No run-time
performance hits compared to equivalent solutions in C.

So are templates. No run-time performance hits. Template syntax, while
horrible, is still more readable/maintainable than equivalent C macros.

For me, also exceptions are genuinely useful. In C code with adequate
error checking, half of the code deals with the error paths, and useful
error messages are often still lacking. YMMV.

I agree that iostreams are pretty useless and have significant run-time
performance hits. But iostreams do not make up most of C++.

Still, the best feature of C++ is RAII (zero run-time performance hit).

Re: Ain't that beautiful ?

<dodQN.493622$yEgf.114692@fx09.iad>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3502&group=comp.lang.c%2B%2B#3502

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!news.nntp4.net!nntp.terraraq.uk!news1.firedrake.org!fnord.no!uucp.uio.no!npeer.as286.net!npeer-ng0.as286.net!peer03.ams1!peer.ams1.xlned.com!news.xlned.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!fx09.iad.POSTED!not-for-mail
X-newsreader: xrn 9.03-beta-14-64bit
Sender: scott@dragon.sl.home (Scott Lurndal)
From: sco...@slp53.sl.home (Scott Lurndal)
Reply-To: slp53@pacbell.net
Subject: Re: Ain't that beautiful ?
Newsgroups: comp.lang.c++
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org> <20240404215534.0000623d@yahoo.com> <uunpq1$14t9p$1@raubtier-asyl.eternal-september.org> <20240405175257.000066a0@yahoo.com> <uup56c$1esu3$1@raubtier-asyl.eternal-september.org> <GLYPN.6$zaCc.4@fx08.iad> <uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org> <03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me>
Lines: 40
Message-ID: <dodQN.493622$yEgf.114692@fx09.iad>
X-Complaints-To: abuse@usenetserver.com
NNTP-Posting-Date: Sat, 06 Apr 2024 14:56:09 UTC
Organization: UsenetServer - www.usenetserver.com
Date: Sat, 06 Apr 2024 14:56:09 GMT
X-Received-Bytes: 2403
 by: Scott Lurndal - Sat, 6 Apr 2024 14:56 UTC

Paavo Helde <eesnimi@osa.pri.ee> writes:
>06.04.2024 00:29 Scott Lurndal kirjutas:
>>
>> Most of C++ is useless cruft with a significant run-time
>> performance hit.
>>
>> Classes are genuinely useful, as are namespaces.
>
>So are standard containers, like std::vector and std::map. No run-time
>performance hits compared to equivalent solutions in C.

For the most part true of std::vector. Not necessarily for
std::map.

>
>So are templates. No run-time performance hits. Template syntax, while
>horrible, is still more readable/maintainable than equivalent C macros.

Poorly used, templates increase the code footprint, sometimes
considerably - often just to avoid a couple of conditionals
in the code.

>
>For me, also exceptions are genuinely useful. In C code with adequate
>error checking, half of the code deals with the error paths, and useful
>error messages are often still lacking. YMMV.

There is a definite run-time cost to using exceptions. And some
C++ code (operating systems, hypervisors) don't have the
run-time infrastructure to support exception handling and stack
unwinding.

>
>I agree that iostreams are pretty useless and have significant run-time
>performance hits. But iostreams do not make up most of C++.
>
>Still, the best feature of C++ is RAII (zero run-time performance hit).

Useful, but can easily be abused (e.g. for locking).

Re: Ain't that beautiful ?

<uurtih$26abt$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3503&group=comp.lang.c%2B%2B#3503

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Sat, 6 Apr 2024 18:34:25 +0200
Organization: A noiseless patient Spider
Lines: 27
Message-ID: <uurtih$26abt$1@raubtier-asyl.eternal-september.org>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me>
<dodQN.493622$yEgf.114692@fx09.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 06 Apr 2024 16:34:25 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="024b50bc71e7b939469fd9a0113587fc";
logging-data="2304381"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX186OfsHQCbLRvKW2S7BToKVomz5Jaw8CX8="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:PyFM9rwRoOpX0lOTobAubABEOGU=
In-Reply-To: <dodQN.493622$yEgf.114692@fx09.iad>
Content-Language: de-DE
 by: Bonita Montero - Sat, 6 Apr 2024 16:34 UTC

Am 06.04.2024 um 16:56 schrieb Scott Lurndal:

> For the most part true of std::vector. Not necessarily for
> std::map.

Show me a better key-value data structure when you
also need to iterate through the KVs in sorting order.

> Poorly used, templates increase the code footprint, ...

They're fast and the code-foooprint may not be tolerable only on very
small systems.

> There is a definite run-time cost to using exceptions. And some
> C++ code (operating systems, hypervisors) don't have the
> run-time infrastructure to support exception handling and stack
> unwinding.

Then don't throw exceptions through that foreign code. I'm often using
lambdas without captures as callbacks to C-interfaces with Win32. With
these callback's I can't use exceptions but that's not a problem.

> Useful, but can easily be abused (e.g. for locking).

Ok, "can be abused", then drop it ! ;-)

Re: Ain't that beautiful ?

<daec0e1e768af35c82b6528119b8fc7385c780b2.camel@gmail.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3504&group=comp.lang.c%2B%2B#3504

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: wynii...@gmail.com (wij)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Sun, 07 Apr 2024 03:00:54 +0800
Organization: A noiseless patient Spider
Lines: 49
Message-ID: <daec0e1e768af35c82b6528119b8fc7385c780b2.camel@gmail.com>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me>
<dodQN.493622$yEgf.114692@fx09.iad>
<uurtih$26abt$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Date: Sat, 06 Apr 2024 19:00:56 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="0d0e763aac56496740fb4500fdba36e0";
logging-data="2346089"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18x6dqe1FcPtwJC18blPcO2"
User-Agent: Evolution 3.50.2 (3.50.2-1.fc39)
Cancel-Lock: sha1:hFOwVwlfvX37EUKGIsWeHU1wAgc=
In-Reply-To: <uurtih$26abt$1@raubtier-asyl.eternal-september.org>
 by: wij - Sat, 6 Apr 2024 19:00 UTC

On Sat, 2024-04-06 at 18:34 +0200, Bonita Montero wrote:
> Am 06.04.2024 um 16:56 schrieb Scott Lurndal:
>
> > For the most part true of std::vector.   Not necessarily for
> > std::map.
>
I estimate ::hsearch(...) is about 20 times faster than std::map, that says it all,
although the key is limited to c-string.

> Show me a better key-value data structure when you
> also need to iterate through the KVs in sorting order.
>
> > Poorly used, templates increase the code footprint, ...
>
> They're fast and the code-foooprint may not be tolerable only on very
> small systems.
>

One of the worst part of C++ is memory consumption, compared with C.
Let's say C program can solve problems of size X, C++ normally solves of size X/2.
This is equivalent to time performance in larger size.

> > There is a definite run-time cost to using exceptions.  And some
> > C++ code (operating systems, hypervisors) don't have the
> > run-time infrastructure to support exception handling and stack
> > unwinding.
>
> Then don't throw exceptions through that foreign code. I'm often using
> lambdas without captures as callbacks to C-interfaces with Win32. With
> these callback's I can't use exceptions but that's not a problem.
>

The problem of 'throw' is context-loss and time cost. For context-loss, you generally
won't be able to have library-level reusable codes. 'Throw' is normally one thousand
times slower than return, this part is, generally speaking, doomed.

The problem of std::exception family is simply unnecessarily complex.

> > Useful, but can easily be abused (e.g. for locking).
>
> Ok, "can be abused", then drop it ! ;-)
>
>

Re: Ain't that beautiful ?

<uusjso$2bl1s$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3505&group=comp.lang.c%2B%2B#3505

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: chris.m....@gmail.com (Chris M. Thomasson)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Sat, 6 Apr 2024 15:55:19 -0700
Organization: A noiseless patient Spider
Lines: 16
Message-ID: <uusjso$2bl1s$1@dont-email.me>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<cone.1712275227.292802.483430.1004@monster.email-scan.com>
<CuHPN.189578$taff.30721@fx41.iad> <20240405174448.00001e50@yahoo.com>
<uup59h$1esu3$2@raubtier-asyl.eternal-september.org>
<20240405183723.0000585f@yahoo.com>
<uup7dg$1febk$1@raubtier-asyl.eternal-september.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sat, 06 Apr 2024 22:55:20 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7c328506b30cc464995f07533aa90da6";
logging-data="2479164"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18y+yVppBjykRXNMAJ1lU1VC1IWsTZQ2Xk="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:IfpBThST7UyK7ZZOz6093jHnIAs=
In-Reply-To: <uup7dg$1febk$1@raubtier-asyl.eternal-september.org>
Content-Language: en-US
 by: Chris M. Thomasson - Sat, 6 Apr 2024 22:55 UTC

On 4/5/2024 9:04 AM, Bonita Montero wrote:
> Am 05.04.2024 um 17:37 schrieb Michael S:
>
>> However I know enough to know that Win32 is defined in terms of C.
>> So I don't quite understand how XHANDLE can be part of it.
>
> It's obvious.
>

Where is XHANDLE defined wrt any Microsoft documentation? Its not:

https://learn.microsoft.com/en-us/cpp/atl/reference/chandle-class?view=msvc-170

Right?

Re: Ain't that beautiful ?

<uutedl$2kq8k$1@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3506&group=comp.lang.c%2B%2B#3506

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Sun, 7 Apr 2024 08:28:05 +0200
Organization: A noiseless patient Spider
Lines: 61
Message-ID: <uutedl$2kq8k$1@raubtier-asyl.eternal-september.org>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me>
<dodQN.493622$yEgf.114692@fx09.iad>
<uurtih$26abt$1@raubtier-asyl.eternal-september.org>
<daec0e1e768af35c82b6528119b8fc7385c780b2.camel@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Date: Sun, 07 Apr 2024 06:28:05 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="700d8c77c3a1204baa8bd911c63ba530";
logging-data="2779412"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19CdrIBtvmwvf0F0+YwU9nBOT25IcVs2PY="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:J3KsVW1t3a3ZYnD4x4UGLZLU3JY=
Content-Language: de-DE
In-Reply-To: <daec0e1e768af35c82b6528119b8fc7385c780b2.camel@gmail.com>
 by: Bonita Montero - Sun, 7 Apr 2024 06:28 UTC

Am 06.04.2024 um 21:00 schrieb wij:
> On Sat, 2024-04-06 at 18:34 +0200, Bonita Montero wrote:
>> Am 06.04.2024 um 16:56 schrieb Scott Lurndal:
>>
>>> For the most part true of std::vector.   Not necessarily for
>>> std::map.
>>
> I estimate ::hsearch(...) is about 20 times faster than std::map, that says it all,
> although the key is limited to c-string.

A tree is slow, but if you need to iterate with key order there's
nothing faster. Hash-maps are O(1) are faster but you can't traverse
the KVs in key-order.

>
>> Show me a better key-value data structure when you
>> also need to iterate through the KVs in sorting order.
>>
>>> Poorly used, templates increase the code footprint, ...
>>
>> They're fast and the code-foooprint may not be tolerable only on very
>> small systems.
>>
>
> One of the worst part of C++ is memory consumption, compared with C.

C++ is not known for its bad memory consumption.

> Let's say C program can solve problems of size X, C++ normally solves of size X/2.
> This is equivalent to time performance in larger size.
>
>>> There is a definite run-time cost to using exceptions.  And some
>>> C++ code (operating systems, hypervisors) don't have the
>>> run-time infrastructure to support exception handling and stack
>>> unwinding.
>>
>> Then don't throw exceptions through that foreign code. I'm often using
>> lambdas without captures as callbacks to C-interfaces with Win32. With
>> these callback's I can't use exceptions but that's not a problem.
>>
>
> The problem of 'throw' is context-loss and time cost. For context-loss, you generally
> won't be able to have library-level reusable codes. 'Throw' is normally one thousand
> times slower than return, this part is, generally speaking, doomed.

Exceptions are only thrown in exceptional cases like I/O-errors or a
memory collapse. That happens very rarely and performance of thrown
exceptions doens't count.

>
> The problem of std::exception family is simply unnecessarily complex.
>
>>> Useful, but can easily be abused (e.g. for locking).
>>
>> Ok, "can be abused", then drop it ! ;-)
>>
>>
>
>

Re: Ain't that beautiful ?

<uuteen$2kq8k$2@raubtier-asyl.eternal-september.org>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3507&group=comp.lang.c%2B%2B#3507

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!raubtier-asyl.eternal-september.org!.POSTED!not-for-mail
From: Bonita.M...@gmail.com (Bonita Montero)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Sun, 7 Apr 2024 08:28:39 +0200
Organization: A noiseless patient Spider
Lines: 21
Message-ID: <uuteen$2kq8k$2@raubtier-asyl.eternal-september.org>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<cone.1712275227.292802.483430.1004@monster.email-scan.com>
<CuHPN.189578$taff.30721@fx41.iad> <20240405174448.00001e50@yahoo.com>
<uup59h$1esu3$2@raubtier-asyl.eternal-september.org>
<20240405183723.0000585f@yahoo.com>
<uup7dg$1febk$1@raubtier-asyl.eternal-september.org>
<uusjso$2bl1s$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 07 Apr 2024 06:28:39 +0200 (CEST)
Injection-Info: raubtier-asyl.eternal-september.org; posting-host="700d8c77c3a1204baa8bd911c63ba530";
logging-data="2779412"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18wVLJNT8lUZ49166C2wMSt58oSTaY/H20="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:kef+23xJBDdSEVt9yDKgr5iImMA=
In-Reply-To: <uusjso$2bl1s$1@dont-email.me>
Content-Language: de-DE
 by: Bonita Montero - Sun, 7 Apr 2024 06:28 UTC

Am 07.04.2024 um 00:55 schrieb Chris M. Thomasson:
> On 4/5/2024 9:04 AM, Bonita Montero wrote:
>> Am 05.04.2024 um 17:37 schrieb Michael S:
>>
>>> However I know enough to know that Win32 is defined in terms of C.
>>> So I don't quite understand how XHANDLE can be part of it.
>>
>> It's obvious.
>>
>
> Where is XHANDLE defined wrt any Microsoft documentation? Its not:

It's obvious that XHANDE is some kind of RAII-wrapper.

>
> https://learn.microsoft.com/en-us/cpp/atl/reference/chandle-class?view=msvc-170
>
> Right?
>
>

Re: Ain't that beautiful ?

<20240407152541.00005236@yahoo.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3508&group=comp.lang.c%2B%2B#3508

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5...@yahoo.com (Michael S)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Sun, 7 Apr 2024 15:25:41 +0300
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <20240407152541.00005236@yahoo.com>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad>
<uurm8q$24ka4$1@dont-email.me>
<dodQN.493622$yEgf.114692@fx09.iad>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 07 Apr 2024 12:25:45 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ea51c234139e61ddeb0e20c94eeecefb";
logging-data="2909767"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+JiWhfFHXD/p2RGSCr2gK7Bepn/oRW6jI="
Cancel-Lock: sha1:HWJAGMk6aU4eteocYITjwKlv5RQ=
X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
 by: Michael S - Sun, 7 Apr 2024 12:25 UTC

On Sat, 06 Apr 2024 14:56:09 GMT
scott@slp53.sl.home (Scott Lurndal) wrote:

> Paavo Helde <eesnimi@osa.pri.ee> writes:
> >06.04.2024 00:29 Scott Lurndal kirjutas:
> >>
> >> Most of C++ is useless cruft with a significant run-time
> >> performance hit.
> >>
> >> Classes are genuinely useful, as are namespaces.
> >
> >So are standard containers, like std::vector and std::map. No
> >run-time performance hits compared to equivalent solutions in C.
>
> For the most part true of std::vector. Not necessarily for
> std::map.
>

IMHO, std::map is a very good default choice when you start coding and
don't know yet if key-value store is going to be big or small,
predominantly read or with significant updating, performance critical
or not and in need of ordering or there would never be such need.
Of course, normally you figure the part about the need of ordering quite
quickly, but sweeping std::map with std:unordered_map is not hard.

The nice thing about std::map is that it's pretty much always within
factor of 10 from the absolutely best custom data structure, both in
memory consumption and in speed, so the choice std::map cam be wrong,
but unlikely to be critically wrong.

Re: Ain't that beautiful ?

<20240407160050.00004370@yahoo.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3509&group=comp.lang.c%2B%2B#3509

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: already5...@yahoo.com (Michael S)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Sun, 7 Apr 2024 16:00:50 +0300
Organization: A noiseless patient Spider
Lines: 64
Message-ID: <20240407160050.00004370@yahoo.com>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad>
<uurm8q$24ka4$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 07 Apr 2024 13:00:55 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ea51c234139e61ddeb0e20c94eeecefb";
logging-data="2909767"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19Em5ga4guA8FFh2SlWW49A6xAzAQPEXMg="
Cancel-Lock: sha1:JPPucVhgmqZmYciIJseMdP7ysGs=
X-Newsreader: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
 by: Michael S - Sun, 7 Apr 2024 13:00 UTC

On Sat, 6 Apr 2024 17:29:45 +0300
Paavo Helde <eesnimi@osa.pri.ee> wrote:
>
> run-time performance hits. But iostreams do not make up most of C++.
>
> Still, the best feature of C++ is RAII (zero run-time performance
> hit).
>

RAII has low run-time cost, although I doubt that it's really zero.
RAII has non-trivial code size cost, esp. when used a lot. See below.
But my main objection with RAII is that I feel like loosing track.

Simple test:
------ foo.cpp
void* allocate_bar(int x);
void free_bar(void* bar);
int foo_bar(void* bar);

int foo(int x)
{ void* bar = allocate_bar(x);
if (bar) {
int ret = foo_bar(bar);
free_bar(bar);
return ret;
}
return -1;
} ------ end of foo.cpp

------ raii-foo.cpp
void* allocate_bar(int x);
void free_bar(void* bar);
int foo_bar(void* bar);

class raii_bar {
public:
void* p;
raii_bar(int x) {
p = allocate_bar(x);
}
~raii_bar() {
if (p)
free_bar(p);
}
};

int foo(int x)
{ raii_bar bar(x);
if (bar.p)
return foo_bar(bar.p);
return -1;
} ------ end of raii-foo.cpp

$ gcc -c -Wall -O2 foo.cpp raii-foo.cpp
$ size *.o
text data bss dec hex filename
136 0 0 136 88 foo.o
172 0 0 172 ac raii-foo.o

Re: Ain't that beautiful ?

<uuu98b$2qou0$1@dont-email.me>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=3510&group=comp.lang.c%2B%2B#3510

  copy link   Newsgroups: comp.lang.c++
Path: i2pn2.org!i2pn.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: david.br...@hesbynett.no (David Brown)
Newsgroups: comp.lang.c++
Subject: Re: Ain't that beautiful ?
Date: Sun, 7 Apr 2024 16:06:02 +0200
Organization: A noiseless patient Spider
Lines: 46
Message-ID: <uuu98b$2qou0$1@dont-email.me>
References: <uumqfq$q6p0$1@raubtier-asyl.eternal-september.org>
<20240404215534.0000623d@yahoo.com>
<uunpq1$14t9p$1@raubtier-asyl.eternal-september.org>
<20240405175257.000066a0@yahoo.com>
<uup56c$1esu3$1@raubtier-asyl.eternal-september.org>
<GLYPN.6$zaCc.4@fx08.iad>
<uupmvv$1j8sq$1@raubtier-asyl.eternal-september.org>
<03_PN.124502$U1cc.11575@fx04.iad> <uurm8q$24ka4$1@dont-email.me>
<20240407160050.00004370@yahoo.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Sun, 07 Apr 2024 14:06:03 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="ac5c995f1f99df99822eb6692eb89ffb";
logging-data="2974656"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/fTmChJQ4IbaoKTkxt+VTKcA+JZ6JnI/I="
User-Agent: Mozilla Thunderbird
Cancel-Lock: sha1:+AJQTHOPVwqg+00DhW6Ch2iec8s=
In-Reply-To: <20240407160050.00004370@yahoo.com>
Content-Language: en-GB
 by: David Brown - Sun, 7 Apr 2024 14:06 UTC

On 07/04/2024 15:00, Michael S wrote:
> On Sat, 6 Apr 2024 17:29:45 +0300
> Paavo Helde <eesnimi@osa.pri.ee> wrote:
>>
>> run-time performance hits. But iostreams do not make up most of C++.
>>
>> Still, the best feature of C++ is RAII (zero run-time performance
>> hit).
>>
>
> RAII has low run-time cost, although I doubt that it's really zero.
> RAII has non-trivial code size cost, esp. when used a lot. See below.
> But my main objection with RAII is that I feel like loosing track.
>

> $ gcc -c -Wall -O2 foo.cpp raii-foo.cpp
> $ size *.o
> text data bss dec hex filename
> 136 0 0 136 88 foo.o
> 172 0 0 172 ac raii-foo.o
>

You will almost certainly find that the overhead here is due to
exception handling and/or RTTI. Add the flag "-fno-execptions
-fno-rtti", and you'll see the same code generated using
<https://godbolt.org>.

For some kinds of code (such as the stuff Scott does, and the stuff I
do), exceptions are an unacceptable overhead, cost and complication in a
language. Many other features of C++ - including RAII, templates,
classes, namespaces, strong enums, overloading, concepts, constexpr,
inline variables, smart pointers, and countless other bits and pieces
can be used to get better source code (clearer, simpler, more flexible,
safer, etc.) without inefficiency overheads compared to similar
solutions in C.

Different people have different needs from C++, and use different
features. If I were programming on a PC, I'd happily use std::map<> and
the like. But I don't program on PC's, and I don't use std::map<>. If
I needed something like that, I'd make my own class that fitted my
requirements tightly - a factor of 10 inefficiency is often fine on big
systems, but not on the devices I work with.

But that's all fine - use whatever you find useful from the language.


devel / comp.lang.c++ / Ain't that beautiful ?

Pages:1234
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor