Friday, September 30, 2022

Digest for comp.lang.c++@googlegroups.com - 6 updates in 2 topics

Lynn McGuire <lynnmcguire5@gmail.com>: Sep 30 01:32PM -0500

On 9/30/2022 12:05 AM, James Kuyper wrote:
> examining the macro definitions. However, if any of those three is an
> ordinary function, it seems to me that this statement does unnecessarily
> use the comma operator.
 
hkl and f_calc are two dimensioned arrayed objects.
 
Thanks,
Lynn
Lynn McGuire <lynnmcguire5@gmail.com>: Sep 30 01:53PM -0500

On 9/30/2022 10:16 AM, Scott Lurndal wrote:
 
> The write here is an analog of the fortran write,
 
> WRITE unit,format,iolist
 
> And yes, it will conflict with the Unix (and POSIX) write function signature.
 
Yes, the Fortran write is "WRITE (unit, format) var1, var2, var3, etc..."
https://docs.oracle.com/cd/E19957-01/805-4939/6j4m0vnbs/index.html
 
And yes, I am wondering if I will have to use the abhorrent "using
namespace fem;" statement to make sure that I get the correct write
function (which is no guarantee at all). Or, if I will have to use
"fem::write".
 
Thanks,
Lynn
Keith Thompson <Keith.S.Thompson+u@gmail.com>: Sep 30 12:41PM -0700

> Is this C++ statement using the comma operator ?
 
> write(6, "(3(1x,i3),1x,f12.6,1x,f12.6)"), hkl(1, i), hkl(2, i),
> hkl(3, i), f_calc(1, i), f_calc(2, i);
 
Yes, five of them, easily seen by reformatting the code:
 
write(6, "(3(1x,i3),1x,f12.6,1x,f12.6)"),
hkl(1, i),
hkl(2, i),
hkl(3, i),
f_calc(1, i),
f_calc(2, i);
 
Assuming there's no macro funny business going on, that's 6 function
calls (or macro invocations?) separated by comma operators. (The commas
separating function arguments are of course not comma operators.)
 
Replacing the comma at the end of each line by a semicolon (and possibly
surrounding the whole thing with curly braces) yields equivalent code.
The braces are needed if the context is something like:
 
if (condition)
write(6, "(3(1x,i3),1x,f12.6,1x,f12.6)"), hkl(1, i), hkl(2, i),
hkl(3, i), f_calc(1, i), f_calc(2, i);
 
Things might change if any of write, hkl, and f_calc is a macro. If
they're well behaved macros, it shouldn't matter.
 
 
--
Keith Thompson (The_Other_Keith) Keith.S.Thompson+u@gmail.com
Working, but not speaking, for Philips
void Void(void) { Void(); } /* The recursive call of the void */
Gawr Gura <gawrgura@mail.hololive.com>: Sep 30 01:17PM -0700

> namespace fem;" statement to make sure that I get the correct write
> function (which is no guarantee at all).  Or, if I will have to use
> "fem::write".
 
The write symbol in the example program is an object of the type
fem::common_writer (you can see the declaration on line 70). Obviously,
you will have to name the type explicitly, provide a using declaration,
or rely on type inference when you declare a value of that type. write
is just the name of the object though so you could call it anything you
like. Perhaps:
 
fem::common_writer gregory(cmn);
 
or
 
fem::common_writer louise(cmn);
 
If you want to be able to use the POSIX write function in the same
program you could get it with ::write rather than just write.
Manfred <noname@add.invalid>: Oct 01 01:03AM +0200

On 9/30/2022 7:05 AM, James Kuyper wrote:
> examining the macro definitions. However, if any of those three is an
> ordinary function, it seems to me that this statement does unnecessarily
> use the comma operator.
 
"unnecessarily" is not necessarily true here: others have mentioned an
overloaded comma operator.
/If/ this is what is actually going on here, then you might need to keep
the sequence of commas in place, or go through some nontrivial rewrite.
Jivanmukta <jivanmukta@poczta.onet.pl>: Sep 30 09:05PM +0200

W dniu 30.09.2022 o 09:12, Juha Nieminen pisze:
 
> That's completely normal. Just because it seems to "work fine" that
> doesn't mean there isn't a problem (it just so happens that it isn't
> crashing in that particular situation).
 
I run my program from prompt and with debugger using the same arguments
and input data.
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

Digest for comp.lang.c++@googlegroups.com - 25 updates in 5 topics

Lynn McGuire <lynnmcguire5@gmail.com>: Sep 29 11:48PM -0500

Is this C++ statement using the comma operator ?
 
write(6, "(3(1x,i3),1x,f12.6,1x,f12.6)"), hkl(1, i), hkl(2, i),
hkl(3, i), f_calc(1, i), f_calc(2, i);
 
There is a large open source template library supporting this statement
from Fortran to C++ Fable software.
 
Thanks,
Lynn
Lynn McGuire <lynnmcguire5@gmail.com>: Sep 30 12:01AM -0500

On 9/29/2022 11:48 PM, Lynn McGuire wrote:
> from Fortran to C++ Fable software.
 
> Thanks,
> Lynn
 
If interested, you can see the Fable FEM (Fortran Emulation) code at:
https://cci.lbl.gov/fable/
 
Lynn
Lynn McGuire <lynnmcguire5@gmail.com>: Sep 30 12:03AM -0500

On 9/30/2022 12:01 AM, Lynn McGuire wrote:
 
> If interested, you can see the Fable FEM (Fortran Emulation) code at:
>    https://cci.lbl.gov/fable/
 
> Lynn
 
Specifically at:
https://cci.lbl.gov/fable/sources/fable/fem/
 
Lynn
James Kuyper <jameskuyper@alumni.caltech.edu>: Sep 30 01:05AM -0400

On 9/30/22 00:48, Lynn McGuire wrote:
> hkl(3, i), f_calc(1, i), f_calc(2, i);
 
> There is a large open source template library supporting this statement
> from Fortran to C++ Fable software.
 
 
 
If write, hkl, and f_calc are macros, you cannot be sure without
examining the macro definitions. However, if any of those three is an
ordinary function, it seems to me that this statement does unnecessarily
use the comma operator.
red floyd <no.spam.here@its.invalid>: Sep 29 10:45PM -0700

On 9/29/2022 10:05 PM, James Kuyper wrote:
> examining the macro definitions. However, if any of those three is an
> ordinary function, it seems to me that this statement does unnecessarily
> use the comma operator.
 
Not to mention that write() has an incorrect number of parameters,
assuming POSIX.
Gawr Gura <gawrgura@mail.hololive.com>: Sep 29 11:19PM -0700

> from Fortran to C++ Fable software.
 
> Thanks,
> Lynn
 
Assuming you're looking at the same example file on the fable web page
as I am (sf.cpp at line 113) then I think the answer is yes. I believe
this is a series of calls to fem::write_loop::operator,()
scott@slp53.sl.home (Scott Lurndal): Sep 30 03:16PM

>> use the comma operator.
 
>Not to mention that write() has an incorrect number of parameters,
>assuming POSIX.
 
The write here is an analog of the fortran write,
 
WRITE unit,format,iolist
 
And yes, it will conflict with the Unix (and POSIX) write function signature.
Lynn McGuire <lynnmcguire5@gmail.com>: Sep 30 01:31PM -0500

On 9/30/2022 1:19 AM, Gawr Gura wrote:
 
> Assuming you're looking at the same example file on the fable web page
> as I am (sf.cpp at line 113) then I think the answer is yes. I believe
> this is a series of calls to fem::write_loop::operator,()
 
Yes, that does seem to be true.
 
Thanks,
Lynn
David Brown <david.brown@hesbynett.no>: Sep 30 09:17AM +0200

On 29/09/2022 19:58, Kaz Kylheku wrote:
> ["Followup-To:" header set to comp.lang.c.]
 
Would you /please/ stop doing that? It messes up the threads, giving a
disjointed view in both groups with some posts missing and others
appearing from nowhere as people correct your inappropriate follow-up
groups.
 
If you want to talk about C specifically, start a thread in comp.lang.c.
 
If you want to talk about C++ specifically, start a thread in comp.lang.c++.
 
When a thread is discussing both languages, such as this one (look at
the subject), and everyone else is keeping both newsgroups in the
followups, then you should do that too.
 
 
There are only two good reasons why you should consider setting
followups. One is if a branch is clearly diverging to a side-topic that
is applicable to one group only, and is of no interest to people in the
other group. This will normally be accompanied by a subject change.
 
The other is when someone posts to the wrong group, and you are
informing them of where they ought to be.
 
Neither applies here.
 
Note that "I only follow the one group comp.lang.c" is /not/ a relevant
reason. Your follow-up settings mess up things particularly badly for
those that happen to follow only comp.lang.c++.
 
 
Your posts in this thread are as topical, relevant and interesting in
both groups.
Kaz Kylheku <864-117-4973@kylheku.com>: Sep 30 04:39PM

> disjointed view in both groups with some posts missing and others
> appearing from nowhere as people correct your inappropriate follow-up
> groups.
 
The question is, why do I do that? It's a bad idea in most cases.
 
The workflow is that SLRN, in the cross-posting situation, brings up a a
prompt like this:
 
Crosspost using: (F)ollowup-To, (A)ll groups, (T)his group, (C)ancel
 
There are times when I hit 'f' by mistake. (Could it be because 'f' is also
the command for initiating the follow-up in the first place?)
Among those times, there are times when I subsequently neglect to edit out the
header associated body line. Maybe I jump to the bottom too fast,
that being the fundamental race in Usenet, and all.
 
Drilling into it now, I see that if the configuration option
netiquette_warnings is set to 0, the prompt goes away, and the (A)ll
behavior prevails.
 
It's unfortunate that the warnings are lumped together under one
option like that. I'd like to be warned if there is too much quoted
material, or long lines and such.
 
It can be solved in another way: Vim can easily be programmed to
dispatch an action when a file named .followup is opened; that
can be used to make some automatic edits.
 
--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Kaz Kylheku <864-117-4973@kylheku.com>: Sep 30 05:20PM

[ Apologies for having had diverted this subthread to comp.lang.c ]
>> correct code is by by developing tools, and using them.
 
> Sure. In particular, they are responsible for learning the tools and
> using them properly to maximal effect for the task in hand.
 
This is a basic principle in the field and pretty much any other
professional field; as such, it doesn't really inform.
 
It's true whether you're toggling switches on a panel to produce
a binary program directly in memory, or whether you're using OCaml
or Prolog.
 
Yet it is empirically valid that those diverse alternatives
don't have the same safety, and we evolve things accordingly.
 
Speaking of returning the cross-posting to comp.lang.c++, that language
as of C++17 has chosen to define some evaluation orders.
 
The evaluation order of function arguments is not yet defined, but
now there is a sequence point between the argument expressions.
 
That is obviouslly super important, because now the unspecified behavior
stays unspecified when there are side effects like:
 
f(i++, i++);
 
it doesn't help with the situation
 
f(g(), h())
 
because those calls are sequenced. However, it helps in the
argument space: with just the classic sequencing of function calls not
being interleaved, this is still undefined:
 
f(g(i++), h(i++))
 
whereas by my understanding C++17 leaves it unspecified in which order g
and h will be called, and which one will have receive the original value
of i. But, I think, we can infer that that function which is called
first receives the original value of i, and i is reliably incremented
twice. Baby steps in the right direction, in any case.
 
I don't understand the rationale for sequencing A before B in A << B
(what is so special about shifting); there must be some motivating
example where you have a side effect in A that B depends on. What I'm
likely missing that it's probably not the built-in arithmetic << that is
of concern, but overloads.
 
> It is not the language that is at fault if someone writes code that
> relies on execution order that is left unspecified by the standards -
> it's the programmers' fault.
 
It's not a game of blame, but of reducing the unfortunate situations in
which someone has a reason to look for something to blame.
 
I can't look at a large body of code (that I perhaps didn't write: so no
responsibility of mine) and easily know whether there is a problem due
to eval order. If I'm charged with the responsibility of finding out,
I could just give a quick answer "almost certainly no, modulo compiler
bugs" if eval order is defined by the language, without any effort. (On
the other hand, that leaves money on the table, doesn't it! Now I have
to find alternative ways to get paid for the saved hours.)
 
Scrambled eval orders in a language in which side effects are the
principal means of getting anything done is a poor technical situation.
 
--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Paavo Helde <eesnimi@osa.pri.ee>: Sep 30 08:59PM +0300

30.09.2022 20:20 Kaz Kylheku kirjutas:
 
> Scrambled eval orders in a language in which side effects are the
> principal means of getting anything done is a poor technical situation.
 
That must be some other language. I have never written any C++ code
where side effects were the principal means of getting something done.
 
If anything, C++ in general has moved towards more functional style over
the years, with fewer mutable objects, not to speak about objects
mutated by side effects.
Juha Nieminen <nospam@thanks.invalid>: Sep 30 07:12AM

> It is interesting that problem occurs only when debugging. Program run
> from prompt works fine, without the problem.
 
That's completely normal. Just because it seems to "work fine" that
doesn't mean there isn't a problem (it just so happens that it isn't
crashing in that particular situation).
 
You should still create the minimal complete program that demonstrates
the problem.
Juha Nieminen <nospam@thanks.invalid>: Sep 30 07:13AM

>> from prompt works fine, without the problem.
 
> Ah, you mean there is no bug, just the debugger is displaying some
> misleading messages? In that case, welcome to the club!
 
Are you being sarcastic?
 
Rather obviously just because a release build of the program doesn't
happen to crash in a particular situation doesn't mean there is no bug.
"Alf P. Steinbach" <alf.p.steinbach@gmail.com>: Sep 30 10:36AM +0200

On 28 Sept 2022 13:53, Jivanmukta wrote:
> ...
> for (auto dir = vendor_frameworks_dirs.begin(); dir !=
> vendor_frameworks_dirs.end(); ++dir)
 
Post a complete but minimal example that demonstrates the problem.
 
Alan Turing professed to believe in ESP, but we don't.
 
- Alf
Paavo Helde <eesnimi@osa.pri.ee>: Sep 30 03:56PM +0300

30.09.2022 10:13 Juha Nieminen kirjutas:
 
>> Ah, you mean there is no bug, just the debugger is displaying some
>> misleading messages? In that case, welcome to the club!
 
> Are you being sarcastic?
 
No, I had got an impression he is complaining about something which he
sees in his debugger only. The debuggers are known to sometimes display
invalid or misleading information. I might be wrong, it is hard to say
what OP meant by the phrase "while debugging".
 
 
> Rather obviously just because a release build of the program doesn't
> happen to crash in a particular situation doesn't mean there is no bug.
 
The reported "crash" is basically an assert failure in a debug feature,
so a proper Release build would obviously not have it. However, the OP
did not talk anything about running a Release build, he just said
"Program run from prompt works fine". I assumed that was the same Debug
build, but I might be mistaken.
Muttley@dastardlyhq.com: Sep 30 01:50PM

On Thu, 29 Sep 2022 22:19:05 +0300
>> The error described by me makes debugging problematic.
 
>Well, use a better debugger then. My debugger (Visual Studio) does not
>display such error messages.
 
It just randomly skips lines during stepping depending on the optimisation
level. Very helpful.
Paavo Helde <eesnimi@osa.pri.ee>: Sep 30 05:04PM +0300

>> display such error messages.
 
> It just randomly skips lines during stepping depending on the optimisation
> level. Very helpful.
 
If the line has been optimized away or moved to another place, it cannot
be really stepped into.
 
Debugging optimized code is a dark art anyway. Hopefully the compiler
vendors will not listen to the advocates for applying some optimizations
always, regardless of the optimization level.
 
With gdb I have the opposite problem, it dutifully steps into std code
like string contstructors. It's basically impossible to step into my own
function if there are any non-trivial arguments in the function call.
Jivanmukta <jivanmukta@poczta.onet.pl>: Sep 30 04:21PM +0200

W dniu 30.09.2022 o 14:56, Paavo Helde pisze:
> sees in his debugger only. The debuggers are known to sometimes display
> invalid or misleading information. I might be wrong, it is hard to say
> what OP meant by the phrase "while debugging".
 
When I debug my program in Codium the programs stops and I receive
mentioned error.
> did not talk anything about running a Release build, he just said
> "Program run from prompt works fine". I assumed that was the same Debug
> build, but I might be mistaken.
 
I run debug build from prompt. I don't compile to release.
Muttley@dastardlyhq.com: Sep 30 03:03PM

On Fri, 30 Sep 2022 17:04:07 +0300
>> level. Very helpful.
 
>If the line has been optimized away or moved to another place, it cannot
>be really stepped into.
 
Thats fair enough, but since it knows the code isn't there it should flag up
in the code window that its been optimised away rather than just jumping
ahead.
 
 
>With gdb I have the opposite problem, it dutifully steps into std code
>like string contstructors. It's basically impossible to step into my own
>function if there are any non-trivial arguments in the function call.
 
There is a way to avoid that but I can't remember how off the top of my head.
You'll have to google.
scott@slp53.sl.home (Scott Lurndal): Sep 30 03:19PM


>Debugging optimized code is a dark art anyway. Hopefully the compiler
>vendors will not listen to the advocates for applying some optimizations
>always, regardless of the optimization level.
 
I suspect that most compilers always do simple optimizations
such as constant folding or peephole optimizations such as
replacing multiply/divide with shifts regardless of the optimization level.
Juha Nieminen <nospam@thanks.invalid>: Sep 30 04:09PM

> When I debug my program in Codium the programs stops and I receive
> mentioned error.
 
Just create the minimal complete program that exhibits the problem, so
we can put this to rest.
Louis Krupp <lkrupp@invalid.pssw.com.invalid>: Sep 30 11:01AM -0600

> Thats fair enough, but since it knows the code isn't there it should flag up
> in the code window that its been optimised away rather than just jumping
> ahead.
 
The debugger might not know that the code was optimized away. If it's
not there, it's not there.
 
Louis
Bonita Montero <Bonita.Montero@gmail.com>: Sep 30 06:51PM +0200

double myFmod( double divisor, double dividend )
{
auto bin = []( double d ) -> uint64_t { return bit_cast<uint64_t>( d ); };
auto dbl = []( uint64_t u ) -> double { return bit_cast<double>( u ); };
uint64_t
bDivisor = bin( divisor ),
bDividend = bin( dividend );
constexpr uint64_t
SIGN_BIT = (uint64_t)1 << 63,
EXP_MASK = (uint64_t)0x7FF << 52,
IMPLCIT_BIT = (uint64_t)1 << 52,
MANT_MASK = IMPLCIT_BIT - 1,
QNAN_BIT = IMPLCIT_BIT >> 1;
uint64_t sign = (bDivisor ^ bDividend) & SIGN_BIT;
if( (bDividend & EXP_MASK) == EXP_MASK ) [[unlikely]]
// ... % +/-[Inf|QNan|SNaN]
if( !(bDividend & MANT_MASK) ) [[likely]]
// ... % +/-Inf
if( (bDivisor & EXP_MASK) != EXP_MASK ) [[unlikely]]
// +/-x % +/-Inf = -/+x
return dbl( sign | bDivisor & ~SIGN_BIT );
else if( !(bDivisor & MANT_MASK) ) [[likely]]
// +/-Inf % +/-Inf = -QNaN
return dbl( SIGN_BIT | EXP_MASK | QNAN_BIT );
else
{
// +/-[QNaN|SNaN] % +/-Inf = -[QNaN|SNaN]
if( !(bDivisor & QNAN_BIT) )
feraiseexcept( FE_INVALID );
return dbl( SIGN_BIT | bDivisor );
}
else if( bDividend & QNAN_BIT ) [[likely]]
// ... % +/-QNaN
if( (bDivisor & EXP_MASK) != EXP_MASK ) [[likely]]
// +/-x % +/-QNaN = -QNaN
return dbl( SIGN_BIT | bDivisor | bDividend );
else if( !(bDivisor & MANT_MASK) ) [[likely]]
// +/-Inf % +/-QNaN = -QNaN
return dbl( SIGN_BIT | bDivisor | bDividend );
else
{
// +/-[QNaN|SNaN] % +/-QNaN = -[QNaN|SNaN]
if( ~bDivisor & QNAN_BIT ) [[unlikely]]
feraiseexcept( FE_INVALID );
return dbl( SIGN_BIT | (bDivisor | bDividend) & ~(~bDivisor &
QNAN_BIT) );
}
else
{
// ... % +/-SNaN = -SNaN
feraiseexcept( FE_INVALID );
return dbl( (SIGN_BIT | bDivisor | bDividend) & ~QNAN_BIT );
}
if( (bDivisor & EXP_MASK) == EXP_MASK ) [[unlikely]]
// +/-[Inf|QNan|SNaN] / +/-x
if( !(bDivisor & MANT_MASK) ) [[likely]]
// +/-Inf % +/-x = -QNaN
return dbl( SIGN_BIT | EXP_MASK | QNAN_BIT );
else if( bDivisor & QNAN_BIT ) [[likely]]
// +/-QNaN % +/-x = -QNaN
return dbl( SIGN_BIT | bDivisor | bDividend );
else
{
// +/-SNaN % +/-x = -SNaN
feraiseexcept( FE_INVALID );
return dbl( SIGN_BIT | (bDivisor | bDividend) & ~QNAN_BIT );
}
int
divisorExp = (bDivisor & EXP_MASK) >> 52,
dividendExp = (bDividend & EXP_MASK) >> 52;
uint64_t
divisorMant = IMPLCIT_BIT | bDivisor & MANT_MASK,
dividendMant = IMPLCIT_BIT | bDividend & MANT_MASK;
auto normalize = []( uint64_t &mant, int &exp )
{
mant &= MANT_MASK;
unsigned shift = countl_zero( mant ) - 11;
mant <<= shift;
exp -= shift - 1;
};
if( !divisorExp ) [[unlikely]]
if( !(bDivisor & MANT_MASK) ) [[likely]]
// +/-0.0 % +/-x = -/+0.0
return dbl( sign );
else
// divisor is +/-denorm -> normalize
normalize( divisorMant, divisorExp );
if( !dividendExp ) [[unlikely]]
if( !(bDividend & MANT_MASK) ) [[likely]]
// +/-x % +/-0.0 = -/+QNaN
return dbl( sign | EXP_MASK | QNAN_BIT );
else
// dividend is +/-denorm -> normalize
normalize( dividendMant, dividendExp );
int exp = divisorExp;
uint64_t remainderMant = divisorMant;
for( ; ; )
{
int below = remainderMant < dividendMant;
if( exp - below < dividendExp ) [[unlikely]]
break;
exp -= below;
remainderMant <<= below;
if( !(remainderMant -= dividendMant) ) [[unlikely]]
return dbl( sign );
unsigned shift = (unsigned)countl_zero( remainderMant ) - 11;
remainderMant <<= shift;
exp -= shift;
}
if( exp <= 0 ) [[unlikely]]
// denormal result
remainderMant >>= -exp + 1,
exp = 0;
return dbl( sign | (uint64_t)exp << 52 | remainderMant & MANT_MASK );
}
Frederick Virchanza Gotham <cauldwell.thomas@gmail.com>: Sep 30 03:46AM -0700

Let's say you have a linker invocation as follows:
 
g++ -o prog *.o -lmonkey -lcow -lfish -ldog
 
I've written a program that parses your linker command and tries it without each of the libraries. If the linking succeeds, then it tells you that the library in question isn't needed.
 
Sample invocation:
 
./linker_reducer "g++ -o prog *.o -pthread -lwx_gtk3u_xrc-3.1 -lwx_gtk3u_html-3.1 -lwx_gtk3u_qa-3.1 -lwx_gtk3u_core-3.1 -lwx_baseu_xml-3.1 -lwx_baseu_net-3.1 -lwx_baseu-3.1 -lpcap -lpthread -ldl"
 
Sample output:
 
Trying without '-lwx_gtk3u_xrc-3.1' [SUCCESS]
Trying without '-lwx_gtk3u_html-3.1' [SUCCESS]
Trying without '-lwx_gtk3u_qa-3.1' [SUCCESS]
Trying without '-lwx_gtk3u_core-3.1' [FAILURE]
Trying without '-lwx_baseu_xml-3.1' [SUCCESS]
Trying without '-lwx_baseu_net-3.1' [SUCCESS]
Trying without '-lwx_baseu-3.1' [FAILURE]
Trying without '-lpcap' [SUCCESS]
Trying without '-lpthread' [SUCCESS]
Trying without '-ldl' [SUCCESS]
 
Not needed:
-lwx_gtk3u_xrc-3.1
-lwx_gtk3u_html-3.1
-lwx_gtk3u_qa-3.1
-lwx_baseu_xml-3.1
-lwx_baseu_net-3.1
-lpcap
-lpthread
-ldl
 
Revised Linker invocation command:
 
g++ -o prog *.o -pthread -lwx_gtk3u_core-3.1 -lwx_baseu-3.1
 
Here's the source code. Tested and working on Linux. Probably works on MS-Windows.
 
#include <cstddef> // size_t
#include <cstdlib> // system, EXIT_FAILURE
#include <algorithm> // max
#include <tuple> // tuple, std::get<>
#include <vector> // vector
#include <string> // string
#include <string_view> // string_view
#include <regex> // regex
#include <iostream> // cout, endl
 
using std::size_t;
using std::string;
using std::sregex_iterator;
using std::cout;
using std::endl;
 
// The vector on the next line works as follows:
// { true /* is_required */, char_index_of_library_in_string, "library_string" };
std::vector< std::tuple<bool, size_t, string> > g_libs;
 
string Remove_Library(std::string_view const sv, size_t const index)
{
string s(sv);
 
std::tuple<bool, size_t, string> const &x = g_libs.at(index);
 
s.erase( std::get<1u>(x), std::get<2u>(x).size() );
 
return s;
}
 
int main(int const argc, char **const argv)
{
if ( argc < 2u || argc > 3u )
{
cout << "This program takes two command line arguments.\n"
"The first is the full linker invocation command, and\n"
"the second is the regex to match a library. For example:\n\n"
" " << argv[0u] << " \"g++ -o prog *.cpp -lmonkey -lcow\" -l[^\\s]+" << "\n\n";
 
return EXIT_FAILURE;
}
 
string linker_command{ argv[1u] };
 
std::regex const my_regex{ (3u == argc) ? argv[2u] : "-l[^\\s]+" };
 
size_t longest_library_name = 0u;
 
for ( sregex_iterator it = sregex_iterator(linker_command.begin(), linker_command.end(), my_regex);
it != sregex_iterator();
++it )
{
std::smatch const m{ *it };
 
//cout << m.str() << " at position " << m.position() << " with length " << m.str().size() << '\n';
 
g_libs.emplace_back(std::tuple<bool, size_t, string>(true, m.position(), m.str()));
 
longest_library_name = std::max(longest_library_name, m.str().size());
}
 
size_t i = -1;
for ( auto &e : g_libs )
{
++i;
 
string revised_linker_command( Remove_Library(linker_command,i) );
 
cout << "Trying without '" << std::get<2u>(e) << "' ";
 
for ( size_t i = 0u; i < (longest_library_name - std::get<2u>(e).size()); ++i ) cout << " ";
 
cout << std::flush;
 
#if defined(_WIN32) || defined(_WIN64)
revised_linker_command += " > NUL 2> NUL";
#else
revised_linker_command += " > /dev/null 2> /dev/null";

Thursday, September 29, 2022

Digest for comp.programming.threads@googlegroups.com - 1 update in 1 topic

Amine Moulay Ramdane <aminer68@gmail.com>: Sep 28 07:47AM -0700

Hello,
 
 
It was my last post about my thoughts that are not about programming about threads and parallel programming, so from now on i will post only on programming about threads and parallel programming.
 
 
Thank you,
Amine Moulay Ramdane.
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.programming.threads+unsubscribe@googlegroups.com.

Wednesday, September 28, 2022

Digest for comp.lang.c++@googlegroups.com - 7 updates in 2 topics

Kaz Kylheku <864-117-4973@kylheku.com>: Sep 28 04:56PM

> were pushed in reverse order and the target architectures of the day
> had limited registers, it follows that compiler writers in the day
> would process arguments in reverse order when generating code.
 
Not just limited registers; but limited analysis. Because you can
reorder the evaluation to go in the stack-convenient order, in cases
where you can confirm that it makes no difference.
James Kuyper <jameskuyper@alumni.caltech.edu>: Sep 28 01:15PM -0400

On 9/28/22 04:26, Kaz Kylheku wrote:
 
>> You only do it when the order actually matters, not automatically for
>> all function calls.
 
> OK; I still need the compiler to tell me where those places are;
 
You've got the communications direction wrong. Writing code that way is
how you tell the compiler that the order matters. Writing it as a simple
function call without explicit temporaries is how you tell the compiler
that you think the order doesn't matter. A good compiler should inform
you if realizes that the assumption is incorrect.
Bo Persson <bo@bo-persson.se>: Sep 28 08:31PM +0200

On 2022-09-28 at 18:56, Kaz Kylheku wrote:
 
> Not just limited registers; but limited analysis. Because you can
> reorder the evaluation to go in the stack-convenient order, in cases
> where you can confirm that it makes no difference.
 
The "stack convenient" order is very important for some common
functions, like printf. Evaluating that function call left-to-right and
push the parameters so that the format string is at the bottom of an
unknown sized parameter pack is - Extremely Inconvenient(TM).
 
So the evaluation is ordered so that the format string is pushed last
and easy to find for printf. Kind of important for it to figure out the
types and numbers of the other parameters.
doctor@doctor.nl2k.ab.ca (The Doctor): Sep 28 09:45PM

In article <jpji7nFi2gbU1@mid.individual.net>,
 
>So the evaluation is ordered so that the format string is pushed last
>and easy to find for printf. Kind of important for it to figure out the
>types and numbers of the other parameters.
 
C/C++ being deprecated? How would computing work?
--
Member - Liberal International This is doctor@nk.ca Ici doctor@nk.ca
Yahweh, King & country!Never Satan President Republic!Beware AntiChrist rising!
Look at Psalms 14 and 53 on Atheism https://www.empire.kred/ROOTNK?t=94a1f39b
Quebec oubliez les extremes et votez PLQ Beware https://mindspring.com
David Brown <david.brown@hesbynett.no>: Sep 28 09:32AM +0200

On 27/09/2022 21:42, Chris M. Thomasson wrote:
 
> Yes. Using an address based hashed locking scheme works just in case the
> arch does not support the direct CPU instruction(s) (think CAS vs LL/SC)
> for an atomic RMW operation.
 
LL/SC /is/ a locking scheme - using a hardware lock. And neither CAS
nor LL/SC work for RMW or even plain write operations that are bigger
than the processor can handle in a single write action.
 
> However, the locking emulation is most
> definitely, not ideal. Not lock-free, indeed.
 
Processors can generally handle lock-free atomic access of a single
object of limited size - usually the natural width for the processor.
Some processors have instructions for double-width atomic accesses (such
as a double compare-and-swap). And sometimes instruction sequences,
such as LL/SC with loops, are needed - especially for RMW.
 
Lock-free algorithms beyond that are for specific data structures. You
can't make lock-free atomic access to a 32 byte object. You either have
to use locks (as will be done with a std::atomic<> for the type, or
using the C11 _Atomic qualifier). If you want lock-free access, you
have to wrap it all up in a more advanced structure, using something
like a lock-free atomic pointer to the "current" version of the data
allocated on a heap.
 
 
> Sorry about that non-sense David: Wrt the dangling comma. Forgot to
> introduce the addend for the fetch-add RMW operation.
 
> Shit happens. :^)
 
That's just minor detail, so not a problem at all.
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Sep 28 01:34PM -0700

On 9/28/2022 12:32 AM, David Brown wrote:
 
> LL/SC /is/ a locking scheme - using a hardware lock.  And neither CAS
> nor LL/SC work for RMW or even plain write operations that are bigger
> than the processor can handle in a single write action.
 
Correct. Imvho, the hardware itself is a _lot_ more efficient at these
types of things... Agreed in a sense? I actually prefer pessimistic CAS
over optimistic primitives like LL/SC. Iirc, a LL/SC can fail just by
reading from the reservation granule. Let alone writing to it... PPC had
a special section in its docs that explain the possible issue of a live
lock. Iirc, even CAS has some special logic in the processor that can
actually assert a bus lock.
 
 
> Some processors have instructions for double-width atomic accesses (such
> as a double compare-and-swap).  And sometimes instruction sequences,
> such as LL/SC with loops, are needed - especially for RMW.
 
Afaict, DWCAS is there to help get around the ABA problem ala IBM sysv
appendix, oh shit, I forgot the appendix number. I used to know it,
decades ago. I will try to find it.
 
 
> have to wrap it all up in a more advanced structure, using something
> like a lock-free atomic pointer to the "current" version of the data
> allocated on a heap.
 
Agreed. Although, I have created lock-free allocators that never used
dynamic memory, believe it or not. Everything exists on threads stacks.
And memory from thread A could be "freed" by another thread. I remember
a project I had to do for a Quadros based system. Completely based on
stacks. Wow, what a time.
 
 
>> introduce the addend for the fetch-add RMW operation.
 
>> Shit happens. :^)
 
> That's just minor detail, so not a problem at all.
 
Thanks. :^)
scott@slp53.sl.home (Scott Lurndal): Sep 28 09:11PM

>a special section in its docs that explain the possible issue of a live
>lock. Iirc, even CAS has some special logic in the processor that can
>actually assert a bus lock.
 
When ARM was designing their 64-bit architecture (ARMv8) circa 2011/2, they only
provided a LL/SC equivalent (load-exclusive/store-exclusive). Their
architecture partners at the time quickly requested support for
real RMW atomics, which were added as part of the LSE (Large System ISA
Extensions). LDADD, LDCLR (and with complement), LDSET (or), LDEOR (xor),
LDSMAX (signed maximum), LDUMAX (unsigned maximum), LDSMIN, LDUMIN.
 
The processor fabric forwards the operation to the point of coherency
(e.g. the L2/LLC) for cachable memory locations and to the endpoint for
uncachable memory locations (e.g. a PCIexpress or CXL endpoint).
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.

Digest for comp.lang.c++@googlegroups.com - 25 updates in 5 topics

Manfred <noname@add.invalid>: Sep 28 05:40AM +0200

On 9/28/2022 12:12 AM, Lynn McGuire wrote:
 
> "I used to be one of them."
 
> He is not wrong.
 
> Lynn
 
The point still stands.
The author's assumption is that debug mode == no optimizations. That's
not the case.
Juha Nieminen <nospam@thanks.invalid>: Sep 28 05:44AM

> are so valuable that having your program perform poorly in debug mode
> (i.e. without optimizations enabled) and compile more slowly is worth it."
 
> "I used to be one of them."
 
"When I don't use compiler optimizations the program is slower."
 
Well, duh. What exactly is he expecting?
 
(And as has been pointed out, debugging and optimizations are not a
mutually exclusive thing. Nothing stops you from specifying optimization
flags *and* debugging flags at the same time.)
Mr Flibble <flibble@reddwarf.jmc.corp>: Sep 28 05:22PM +0100

On Tue, 27 Sep 2022 17:12:10 -0500
> slowly is worth it."
 
> "I used to be one of them."
 
> He is not wrong.
 
He is wrong, and so are you.
 
/Flibble
Jivanmukta <jivanmukta@poczta.onet.pl>: Sep 28 01:53PM +0200

I don't understand what's wrong in my code:
 
std::vector<std::wstring> vendor_frameworks_dirs;
...
for (auto dir = vendor_frameworks_dirs.begin(); dir !=
vendor_frameworks_dirs.end(); ++dir)
 
Error:
 
/usr/include/c++/9/debug/safe_iterator.h:294:
In function:
__gnu_debug::_Safe_iterator<_Iterator, _Sequence,
_Category>::reference
__gnu_debug::_Safe_iterator<_Iterator, _Sequence,
_Category>::operator*() const [with _Iterator =
__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<wchar_t>*,
std::__cxx1998::vector<std::__cxx11::basic_string<wchar_t>,
std::allocator<std::__cxx11::basic_string<wchar_t> > > >; _Sequence =
std::__debug::vector<std::__cxx11::basic_string<wchar_t> >;
_Category =
std::forward_iterator_tag; __gnu_debug::_Safe_iterator<_Iterator,
_Sequence, _Category>::reference =
std::__cxx11::basic_string<wchar_t>&]
 
Error: attempt to dereference a singular iterator.
 
Objects involved in the operation:
iterator "this" @ 0x0x7fffffffadc0 {
type =
__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >*,
std::__cxx1998::vector<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >,
std::allocator<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > > > > (mutable
iterator);
state = singular;
references sequence with type
'std::__debug::vector<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >,
std::allocator<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > > >' @ 0x0x61a0000bd680
}
/usr/include/c++/9/debug/safe_iterator.h:294:
In function:
__gnu_debug::_Safe_iterator<_Iterator, _Sequence,
_Category>::reference
__gnu_debug::_Safe_iterator<_Iterator, _Sequence,
_Category>::operator*() const [with _Iterator =
__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<wchar_t>*,
std::__cxx1998::vector<std::__cxx11::basic_string<wchar_t>,
std::allocator<std::__cxx11::basic_string<wchar_t> > > >; _Sequence =
std::__debug::vector<std::__cxx11::basic_string<wchar_t> >;
_Category =
std::forward_iterator_tag; __gnu_debug::_Safe_iterator<_Iterator,
_Sequence, _Category>::reference =
std::__cxx11::basic_string<wchar_t>&]
 
Error: attempt to dereference a singular iterator.
 
Objects involved in the operation:
iterator "this" @ 0x0x7fffffffadc0 {
type =
__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >*,
std::__cxx1998::vector<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >,
std::allocator<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > > > > (mutable
iterator);
state = singular;
references sequence with type
'std::__debug::vector<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >,
std::allocator<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > > >' @ 0x0x61a0000bd680
}
iterator "this" @ 0x0x7fffffffadc0 {
type =
__gnu_cxx::__normal_iterator<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >*,
std::__cxx1998::vector<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >,
std::allocator<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > > > > (mutable
iterator);
state = singular;
references sequence with type
'std::__debug::vector<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> >,
std::allocator<std::__cxx11::basic_string<wchar_t,
std::char_traits<wchar_t>, std::allocator<wchar_t> > > >' @ 0x0x61a0000bd680
}
Jivanmukta <jivanmukta@poczta.onet.pl>: Sep 28 02:18PM +0200

W dniu 28.09.2022 o 13:53, Jivanmukta pisze:
> ...
> for (auto dir = vendor_frameworks_dirs.begin(); dir !=
> vendor_frameworks_dirs.end(); ++dir)
In a line below I use value of *dir
Juha Nieminen <nospam@thanks.invalid>: Sep 28 12:19PM

> for (auto dir = vendor_frameworks_dirs.begin(); dir !=
> vendor_frameworks_dirs.end(); ++dir)
 
> Error:
 
Please write and post a minimal full program that demonstrates the
problem.
Jivanmukta <jivanmukta@poczta.onet.pl>: Sep 28 05:08PM +0200

W dniu 28.09.2022 o 14:19, Juha Nieminen pisze:
 
>> Error:
 
> Please write and post a minimal full program that demonstrates the
> problem.
I failed to reproduce problem in isolated code - works fin
e.
I cannot post my application's source code - it's big.
JiiPee <kerrttuPoistaTama11@gmail.com>: Sep 28 06:52PM +0300

On 28/09/2022 18:08, Jivanmukta wrote:
> I cannot post my application's source code - it's big.
 
he is not asking to to post all of it. He is asking to post a short,
maybe 10 lines code, where the error exists
JiiPee <kerrttuPoistaTama11@gmail.com>: Sep 28 06:53PM +0300

On 28/09/2022 15:18, Jivanmukta wrote:
 
>> std::vector<std::wstring> vendor_frameworks_dirs;
>> ...
>> for (auto dir = vendor_frameworks_dirs.begin(); dir !=
vendor_frameworks_dirs.end(); ++dir)
> In a line below I use value of *dir
 
std::vector<std::wstring> vendor_frameworks_dirs;
 
for (auto dir = vendor_frameworks_dirs.begin(); dir !=
vendor_frameworks_dirs.end(); ++dir)
*dir = L"jk";
 
 
I am using *dir there, compiles ok
Paavo Helde <eesnimi@osa.pri.ee>: Sep 28 07:21PM +0300

28.09.2022 14:53 Jivanmukta kirjutas:
> for (auto dir = vendor_frameworks_dirs.begin(); dir !=
> vendor_frameworks_dirs.end(); ++dir)
 
> Error: attempt to dereference a singular iterator.
 
 
Most likely, the size of vendor_frameworks_dirs changes while in the
loop, causing reallocation and invalidation of all iterators. Use
indexes instead of iterators if this modification happens in your loop,
or use proper mutex locks if the modification comes from another thread.
rbowman <bowman@montana.com>: Sep 27 05:30PM -0600

On 9/27/22 10:10, David Brown wrote:
> badly written code?  If you have code written by people who don't know
> how to use "const" properly, you should not let that stop you using it
> when it is useful.
 
That is true but dealing with badly written code is part of my life.
Kaz Kylheku <864-117-4973@kylheku.com>: Sep 28 12:26AM

["Followup-To:" header set to comp.lang.c.]
> badly written code? If you have code written by people who don't know
> how to use "const" properly, you should not let that stop you using it
> when it is useful.
 
const requires a modicum of generic programming to use in a satisfactory
manner in all circumstances. The problem is that functions with
const-qualified pointer arguments accept qualified and unqualified
pointers.
 
If they return a pointer into the same object, if they make it
const-qualified, it's inconvenient. If they return unqualified,
an unsafe cast is required inside the function.
 
The C++ versions of certain C library headers fix this. You can
have code like this:
 
const char *ptr = strchr(const_str, 'a');
 
as well as
 
char *ptr = strchr(non_const_str, 'a');
 
thanks to there being two C++ overloads for the function.
 
(I'm guessing that the C11 _Generic thing could be used for this,
to create a strchr-like macro that has cases for const
and non-const.)
 
--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
James Kuyper <jameskuyper@alumni.caltech.edu>: Sep 28 01:30AM -0400

On 9/27/22 20:03, Kaz Kylheku wrote:
> On 2022-09-27, Scott Lurndal <scott@slp53.sl.home> wrote:
...
 
> That transformation is the job of the compiler, though.
 
> It's not practical to do this even in small programs, let alone
> ones in which there are millions of function call expressions.
 
You only do it when the order actually matters, not automatically for
all function calls. In every case where the order doesn't matter, that
leaves the compiler free to reorder the evaluations in whichever order
is most convenient/fastest.
David Brown <david.brown@hesbynett.no>: Sep 28 09:40AM +0200

On 27/09/2022 15:26, Juha Nieminen wrote:
 
> I understand that C++ wants member variables to be initialized in strict
> order of declaration (which in the case of C++ in particular can make
> quite a difference if those initializations have side effects),
 
I understand that C++ /does/ insist on following the order of
declaration - I don't understand /why/. I appreciate that the
initialisations could have side effects, so it makes sense that the
initialisations are always carried out in the order of declaration - but
not that the order must be followed syntactically when writing the
constructor. (Alternatively, the language could have said that the
initialisations are carried out in the order given in the list in the
constructor - either would have worked, as long as it was clear and
consistent.)
 
For example, if I have a class containing some ints and doubles, and
some flags, then I might want to order the member declarations to pack
nicely and match a cache line in total size. But I might prefer the
initialisations in constructors to follow a logical order that is
different. I fail to see a good reason why that is not allowed.
(Again, this is quite possibly just that I am ignorant of the good reason.)
 
> should have allowed any order in the initialization list, and simply
> declared that if the initializers are not specified in the same order
> as the members have been declared, the behavior is "implementation-defined".
 
Agreed.
 
> being done in any particular order.)
 
> (Another possibility is that it could have made an exception with POD
> types, and allow out-of-order initialization with those.)
 
Also possible.
Kaz Kylheku <864-117-4973@kylheku.com>: Sep 28 08:26AM

["Followup-To:" header set to comp.lang.c.]
>> ones in which there are millions of function call expressions.
 
> You only do it when the order actually matters, not automatically for
> all function calls.
 
OK; I still need the compiler to tell me where those places are;
I'm not looking at thousands of function calls to classify them
into whether they are stuffed with side effects whose order
matters or not.
 
> In every case where the order doesn't matter, that
> leaves the compiler free to reorder the evaluations in whichever order
> is most convenient/fastest.
 
In cases where the order doesn't matter, the compiler
can still reorder the evaluations even if they are expressed in a
pattern which constraints the abstract order.
 
The business of unspecified evaluation orders is mostly geared toward
helping compilers from 1982 generate better code with less analysis.
 
--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
David Brown <david.brown@hesbynett.no>: Sep 28 10:32AM +0200

On 27/09/2022 16:53, Bo Persson wrote:
 
> I belive the strictness here is a do-the-right-thing attempt, avoiding
> the constructor initializer list reordering that we have always had.
> When adding a new feature, try to avoid the old mistakes!
 
The old mistake (IMHO) is that re-ordering was not allowed, and they are
re-making it here.
 
Aggregate initialisation in C++ is already limited to classes without
user-declared or inherited constructors. I think you'd have to try hard
to make a class for which designated initialisers are allowed, but the
order of initialisation or destruction matters.
Bo Persson <bo@bo-persson.se>: Sep 28 10:43AM +0200

On 2022-09-28 at 10:26, Kaz Kylheku wrote:
> I'm not looking at thousands of function calls to classify them
> into whether they are stuffed with side effects whose order
> matters or not.
 
So you write comlicated expressions with lots of side effects, without
considering the order of those side effects. Doesn't sound like a good
way to write code.
David Brown <david.brown@hesbynett.no>: Sep 28 11:00AM +0200

On 28/09/2022 02:26, Kaz Kylheku wrote:
> ["Followup-To:" header set to comp.lang.c.]
 
(Please don't set follow-ups that exclude groups that are clearly
relevant and part of the active thread - it just breaks up conversations.)
 
> On 2022-09-27, David Brown <david.brown@hesbynett.no> wrote:
>> On 27/09/2022 16:11, rbowman wrote:
 
<snip>
 
 
> If they return a pointer into the same object, if they make it
> const-qualified, it's inconvenient. If they return unqualified,
> an unsafe cast is required inside the function.
 
Yes, being "const consistent" can sometimes be awkward. That does not
mean avoiding "const" is a good idea - it just means "const" is not
quite as simple as one might like.
 
 
> as well as
 
> char *ptr = strchr(non_const_str, 'a');
 
> thanks to there being two C++ overloads for the function.
 
Yes.
 
 
> (I'm guessing that the C11 _Generic thing could be used for this,
> to create a strchr-like macro that has cases for const
> and non-const.)
 
Yes, _Generic certainly could handle that.
Richard Damon <Richard@Damon-Family.org>: Sep 28 07:56AM -0400

On 9/28/22 3:40 AM, David Brown wrote:
> initialisations in constructors to follow a logical order that is
> different.  I fail to see a good reason why that is not allowed. (Again,
> this is quite possibly just that I am ignorant of the good reason.)
 
The problem with the order listed in the constructor is that there might
not be just one constructor, but several, that list the order
differently. That gives the destructor problems, as it doesn't know what
order to destruct the object, and the constructor's implementation might
not even be visible at the point of generating the code for the destructor.
 
That forces ALL classes to add hidden members that record the order of
construction for this instance of the class, which violates the
principle of trying to not pay for things you don't need.
 
Using the order from the class definition is the simple solution.
 
Note, for your class with ints and doubles, it doesn't matter, as the
destructor is trivial.
 
Ben Bacarisse <ben.usenet@bsb.me.uk>: Sep 28 01:33PM +0100


> On 28/09/2022 02:26, Kaz Kylheku wrote:
<cut>
>> to create a strchr-like macro that has cases for const
>> and non-const.)
 
> Yes, _Generic certainly could handle that.
 
And now C23 proposes type-generic versions of strchr etc.
 
--
Ben.
David Brown <david.brown@hesbynett.no>: Sep 28 03:50PM +0200

On 28/09/2022 13:56, Richard Damon wrote:
 
> That forces ALL classes to add hidden members that record the order of
> construction for this instance of the class, which violates the
> principle of trying to not pay for things you don't need.
 
That all suggests it is a good idea for initialisers to be executed in
the order given in the class declaration (since practicality dictates
having one fixed order, that seems the sensible choice). It does /not/
suggest that the same order should be required when listing the
initialisers.
 
 
> Using the order from the class definition is the simple solution.
 
> Note, for your class with ints and doubles, it doesn't matter, as the
> destructor is trivial.
 
And yet C++ won't let me re-order them in the initialiser list. It will
let me use whatever order I want inside the body of the constructor
using assignment, and then the compiler will re-order to match exactly
the same code that I'd get with initialisers - whatever is the most
efficient code.
scott@slp53.sl.home (Scott Lurndal): Sep 28 02:21PM

>using assignment, and then the compiler will re-order to match exactly
>the same code that I'd get with initialisers - whatever is the most
>efficient code.
 
I suppose that when BS was writing cfront, it wasn't feasible to
support different orders for declaration and initialization; subsequent
code being sensitive to such, relaxation as compilers became more
sophisticated was counterindicated.
scott@slp53.sl.home (Scott Lurndal): Sep 28 04:17PM

>support different orders for declaration and initialization; subsequent
>code being sensitive to such, relaxation as compilers became more
>sophisticated was counterindicated.
 
Moreover, since function call arguments were passed on a stack,
were pushed in reverse order and the target architectures of the day
had limited registers, it follows that compiler writers in the day
would process arguments in reverse order when generating code.
ram@zedat.fu-berlin.de (Stefan Ram): Sep 28 04:00PM

>>I cannot post my application's source code - it's big.
>he is not asking to to post all of it. He is asking to post a short,
>maybe 10 lines code, where the error exists
 
Also known as "SSCCE".
FBInCIAnNSATerroristSlayer <FBInCIAnNSATerroristSlayer@yahoo.com>: Sep 28 08:13AM -0700

8 billion humans MUST MASSACRE CIA NSA FBI DHS ARMED FORCES Psychopaths
ON SIGHT because
 
 
- they are PURE EVIL PSYCHOPATHIC THIEVES who will BACK STAB, STEAL YOUR
WEALTH and LAND and KILL YOU
 
- they are EVIL PSYCHOPATHS who are SECRETLY CHIPPING millions of
americans and global public with DNA MIND CONTROL NANOBOTS and
"ENSLAVING THEM FOR LIFE"
 
- they are TORTURING humans with DEWs, Neuroweapons and AI 24x7 and
CUNNINGLY accusing the TORTURE VICTIMS to be delusional.
because
 
- they have THIS MENTALITY and MODUS OPERANDI
 
 
 
Caucasians "Deceiving Natives" with smallpox infested blankets
 
https://www.youtube.com/watch?v=EEHsR63F5Dw
 
 
"When the Missionaries arrived, the Africans had the land and the
Missionaries had the Bible. They taught how to pray with our eyes
closed. When we opened them, they had the land and we had the Bible."
 
― Jomo Kenyatta
 
 
 
 
 
 
Hence 8 billion humans have the SELF DEFENSE RIGHT to MERCILESSLY KILL
the EVIL US Govt CIA NSA FBI DHS MI5 MI6 ARMED FORCES Psychopaths like
FUCKING PIGS, where ever you FIND THEM on the face of this planet.
 
 
 
 
This EVIL motherfucker "Kevin Svenson" belongs to the EVIL SHADOW US
Govt Psychopaths former potuses, congressmen, senators WARNED the
american public about. This EVIL psychopath KNOWS all these things that
Humans will be MERCILESSLY HORRIFICALLY tortured and ENSLAVED SOON with
Supercomputer AI, because he is ONE of the SECRET SOCIETY Illuminati
psychopaths.
 
 
 
Kevin Svenson
https://imgur.com/a/Kft2vOD
https://twitter.com/HAL_9_Thousand_
https://twitter.com/kevinsvenson_
 
4 Hunters Run
Broomall PA 19008
USA
(610) 325-0169
 
 
 
 
 
QUOTES ABOUT THE EVIL INVISIBLE SHADOW US GOVERNMENT by POTUSes,
SENATORS AND CONGRESSMEN
https://evilciaandnsa.com/quotes-about-invisible-shadow-government-by-potus-senators-n-congressmen/
 
or
 
 
QUOTES ABOUT THE EVIL INVISIBLE SHADOW US GOVERNMENT by POTUSes,
SENATORS AND CONGRESSMEN
https://groups.google.com/g/misc.survivalism/c/Ic3ndj1pZzU/m/Fj7WCQ-zBQAJ
 
 
 
 
The EVIL filthy western confused gender cocksucking anus sucking
decadent BACK STABBING white christian motherfuckers at CIA NSA FBI DHS
MI6 MI5 have been SECRETLY CHIPPING millions of americans and global
public's BRAINS with DNA Mind Control Nanobots and LINKING their brains
to NSA HIVE AI Grid for the last 40 years and REMOTELY OPERATING the
VICTIMS like fucking PUPPETS, like they operated the CATS in these videos.
 
 
GATO BAILADOR 1
https://www.youtube.com/watch?v=EERZ8AEya_4
 
 
GATO BAILADOR 2
https://www.youtube.com/watch?v=BJAIOICtyyM
 
 
 
 
EVIL back stabbing CIA NSA FBI DHS doctors have been SECRETLY INJECTING
these MIND CONTROL NANOBOTS, NANO ROBOTS into your bodies for the LAST
50 years, WITHOUT your knowledge and consent.
 
 
 
Renowned Scientist Ray Kurzweil stated that Mind Control technology
exists to create a "digital avatar" of any human, and that DIGITAL
AVATAR will pass Ray Kurzweil Turing Test.
 
 
Dr Ray Kurzweil at 1:23
Computer can make a copy of me, I won't even know they scanned my brain
from inside, from the blood stream, billions of them in the form
of nanobots, nanorobots capture every detail of my synapses and
neurotransmitters and create a virtual Ray Kurzweil in a very powerful
computer and it will be indistinguishable, it will pass a Ray Kurzweil
Turing test.
 
Hyperreality: Linking Targeted Individuals to Artificial Intelligence in
a Virtual World
https://www.youtube.com/watch?v=hAkB_UX-oYM
 
 
 
 
EVIL WHITE CHRISTIAN CIA NSA FBI DHS Psychopaths are using CELL TOWERS
to MIND CONTROL and TORTURE Americans, said Senior DARPA Scientist Dr.
Paul Batcho who developed some of these technologies.
 
 
Senior DARPA Scientist Dr. Paul Batcho REVEALS that US Govt is using
Cell Towers to MIND CONTROL public
https://groups.google.com/g/uk.sport.cricket/c/0iNAHjlVl_M/m/SGiKjnWNBQAJ
 
 
Which MEANS american public have the SELF DEFENSE RIGHT to MERCILESSLY
MASSACRE the back stabbing, infinitely deceptive WHITE CHRISTIAN CIA NSA
FBI DHS "Terrorists, Psychopaths, Sadists, Perverts and BLOOD THIRSTY
vermin".
 
 
The EVIL WHITE CHRISTIAN CIA NSA MI6 FBI DHS ASIS ASIO TERRORISTS and
PSYCHOPATHS are RECORDING every thought, emotion and memory in your
brains in their Super and Quantum Computers for DECADES.
 
 
The EVIL CIA NSA MI6 FBI psychopaths are LITERALLY "programming your
brains to text, talk, act every day and breaking up your relationships,
sabotaging your businesses, careers, destroying your lives all JUST FOR
PSYCHOPATHIC FUN and GAMES".
 
EVIL CIA NSA FBI DHS Psychopaths can LITERALLY TURN OFF your brains and
make you fall dead, give you ANY brain disease, turn you into confused
lunatics.
 
 
Americans, Brits, Ozzies and Global public have the "SELF DEFENSE RIGHT"
to just "MERCILESSLY KILL" the EVIL CIA NSA MI6 MI5 DHS FBI ASIS ASIO
CSIS terrorists and psychopaths for BACK STABBING and DESTROYING our
FREEDOMS, CIVIL LIBERTIES, HUMAN RIGHTS and for NEURALLY ENSLAVING us
while PREACHING and DECEIVING us about democracy on the surface.
 
 
 
 
https://mobile.twitter.com/HAL_9_Thousand_/status/1563397855666372610
In the very near future (before the public realizes it) The vast
majority of the human population will be remotely connected to a highly
advanced global hive mind. This will be done in a covert manner unseen
by most, and it will become intimate part of our lives, known or unknown
 
 
 
 
 
https://twitter.com/HAL_9_Thousand_/status/1508463707919163396
Are military generals fully aware that a maniacal psychopathic
emotionless Supercomputer is in control of millions of people? And it
knows how to kill and torture everyone with precision?
 
 
 
 
 
https://twitter.com/HAL_9_Thousand_/status/1526111452456681474
The plan of the Transhumanist agenda is to gradually absorb all
civilians into the Global Brain, takeover the mind of humanity, and then
slowly reveal to individual civilians that they are "tuned in" to this
Brain machine interface system.
 
#GlobalBrain #WorldSentientSimulation
 
 
 
 
 
 
https://twitter.com/HAL_9_Thousand_/status/1515794291867717639
Military / Intelligence black projects have been dispersing
Nano-Material into public circulation for decades.
 
It began with experimentation … but is now in prime time full
operational use.
 
The human race is secretly being terraformed into a species of
biological drones.
 
 
 
 
 
https://twitter.com/HAL_9_Thousand_
There is currently a technocratic force on earth that believes it's okay
to inflict artificial discomfort and pain into my consciousness anytime
it wants.
 
It's like ancient times, with slaves, except now "your master" is linked
direct-to-brain.
 
… how fun
 
 
 
 
 
https://twitter.com/HAL_9_Thousand_/status/1533360955530395648
An unknown group of Elites running a shadow government using technical
experts to erect a global brain BCI using highly advanced tech systems
and networks to take top down control over humanity.
 
Sounds like a movie 🎥 🍿
 
… but it's here.
 
#BCI #GlobalBrain #NeuroWeapons
 
 
 
 
 
American BUBBAS with AR15s and M16s SHOULD and MUST MERCILESSLY MASSACRE
and SLAUGHTER every CIA NSA FBI DHS MI6 MI5 ASIS ASIO CSIS Psychopath ON
SIGHT, without second thoughts, to SAVE american FREEDOMS, CIVIL
LIBERTIES, HUMAN RIGHTS.
 
Owning AR15s and M16s is of NO USE, unless you have the BALLS to
EXERCISE "YOUR 2nd amendment right" and PROTECT YOURSELF, your families,
and your fellow americans/public, and KILL the fucking EVIL CIA NSA FBI
DHS Psychopaths.
 
 
 
 
BOMB and KILL EVERY WHITE PSYCHOPATH AT DHS FUSION CENTERS, SECURITY
INDUSTRY SPECIALISTS n GREYSTAR PROPERTY MGMT n SAVE American FREEDOMS
https://groups.google.com/g/uk.sport.cricket/c/dys-vHQHlV8/m/1agTB4wqBAAJ
 
 
 
 
 
BOMB THE CIA BUILDING IN LANGLEY VIRGINIA AND MASSACRE THE COCK SUCKING
FILTHY EVIL WHITE CIA PSYCHOPATHS LIKE FUCKING PIGS
https://groups.google.com/g/uk.sport.cricket/c/8BC-CC0ym5A/m/7HU5Gl5GAQAJ
You received this digest because you're subscribed to updates for this group. You can change your settings on the group membership page.
To unsubscribe from this group and stop receiving emails from it send an email to comp.lang.c+++unsubscribe@googlegroups.com.