Tuesday, October 18, 2022

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

Paul N <gw7rib@aol.com>: Oct 18 05:13AM -0700

On Tuesday, October 18, 2022 at 12:11:00 AM UTC+1, Manfred wrote:
 
> > The word "leverage" is NOT a buzzword.
 
> > /Flibble
 
> You are lacking a vision of the synergies ;)
 
When I first saw "role model" used as a verb I thought "No, I'm not going to let this become a phrase". But it seems I failed. I wonder if my managers have any idea why I put "Strongly disagree" whenever a survey asks me whether I think top management role model the corporate values.
Muttley@dastardlyhq.com: Oct 18 03:04PM

On Mon, 17 Oct 2022 17:47:27 +0100
>> > drill down and run with the mission statement? :)
 
>> I think he just wanted to actualize the synergies.
 
>The word "leverage" is NOT a buzzword.
 
When its used in place of "use" then thats exactly what it is. Leverage is
the outcome of using a lever, not a programming language.
Mr Flibble <flibble@reddwarf.jmc.corp>: Oct 18 05:40PM +0100

On Tue, 18 Oct 2022 15:04:01 -0000 (UTC)
 
> >The word "leverage" is NOT a buzzword.
 
> When its used in place of "use" then thats exactly what it is.
> Leverage is the outcome of using a lever, not a programming language.
 
Yes leverage is the outcome of using a lever which is why it is a
perfectly cromulent word to use when describing using a METAPHORICAL
lever. It is NOT a buzzword.
 
/Flibble
"daniel...@gmail.com" <danielaparker@gmail.com>: Oct 18 12:14PM -0700

On Tuesday, October 18, 2022 at 12:40:23 PM UTC-4, Mr Flibble wrote:
 
> Yes leverage is the outcome of using a lever which is why it is a
> perfectly cromulent word to use when describing using a METAPHORICAL
> lever. It is NOT a buzzword.
 
It's leveraging the English ...
Pawel Por <porparek@gmail.com>: Oct 18 10:42AM -0700

Hello,
I receive the following compilation errors:
 
error: non-template 'BSTNode' used as template
std::ostream& operator<<(std::ostream& out, const typename BST<T>::BSTNode<M>& elem)
note: use 'BST<T>::template BSTNode' to indicate that it is a template
 
error: too many template-parameter-lists
std::ostream& operator<<(std::ostream& out, const typename BST<T>::BSTNode<M>& elem)
 
Please help me to to solve this issue. Thank you in advance.
The code is as follows:
 
#include <iostream>
 
template<typename T>
class BST
{
template<typename L>
struct BSTNode
{
template<typename M>
friend std::ostream& operator<<(std::ostream& out, const BSTNode<M>& elem);
};
};
 
template<typename T>
template<typename M>
std::ostream& operator<<(std::ostream& out, const typename BST<T>::BSTNode<M>& elem) // !!! COMPILATION ERRORS !!!
{
out << elem.val;
return out;
}
 
int main(int argc, char **argv)
{
return 0;
}
Bonita Montero <Bonita.Montero@gmail.com>: Oct 18 08:22PM +0200

I think your class-template is nested and the calling operator mustn't
be nested.
 
 
Am 18.10.2022 um 19:42 schrieb Pawel Por:
 
> template<typename T>
> template<typename M>
 
template<typename T, typename M>
 
olcott <polcott2@gmail.com>: Oct 18 10:20AM -0500

*Professor Sipser has agreed to these verbatim words* (and no more)
If simulating halt decider *H correctly simulates its input D until H*
*correctly determines that its simulated D would never stop running*
*unless aborted* then H can abort its simulation of D and correctly
report that D specifies a non-halting sequence of configurations.
 
On 10/17/2022 10:23 AM, Ben Bacarisse wrote:
> ...D(D) would not halt unless H stops the simulation.
> H /can/ correctly determine this silly criterion
> (in this one case)...
 
H /can/ correctly determine this silly criterion (in this one case)...
 
When we apply ordinary code analysis to the Sipser_H simulation of
Sipser_D we empirically verify that Sipser_H does correctly simulate the
first seven instructions of Sipser_D.
 
This same correct code analysis conclusively proves that Sipser_D would
never stop running unless Sipser_H aborts its simulation of Sipser_D.
Anyone having sufficient technical competence can confirm this on the
basis of page 3 of this paper. The abstract has been specifically
approved by professor Sipser for this paper:
 
*Rebutting the Sipser Halting Problem Proof*
https://www.researchgate.net/publication/364302709_Rebutting_the_Sipser_Halting_Problem_Proof
 
 
Full execution trace is in Halt7_Sipser.txt linked below:
int main()
{
Sipser_D(Sipser_D);
}
 
Complete halt deciding system (Visual Studio Project) Sipser version.
(a) x86utm operating system
(b) x86 emulator adapted from libx86emu to compile under Windows
(c) Several halt deciders and their sample inputs contained within Halt7.c
(d) The execution trace of Sipser_H applied to Sipser_D is shown in
Halt7_Sipser.txt
https://liarparadox.org/2022_10_08.zip
 
 
--
Copyright 2022 Pete Olcott "Talent hits a target no one else can hit;
Genius hits a target no one else can see." Arthur Schopenhauer
Juha Nieminen <nospam@thanks.invalid>: Oct 18 07:06AM

> I would like to assign it a OnClick Event Handler in a procedureal
> global function (not a member of a class).
> How can I do this ?
 
This is a generic C++ discussion forum, not a forum about that library
you are using.
 
That does not mean you can't ask that question here. However, it *does*
mean that you should give more details. We don't know what "TForm" or
"TSpeedButton" or any of those other things are. (And no, you can't
expect us to do the googling. It should be you who does the work to
make it as easy as possible for us to answer the question from a
C++ perspective.)
 
Present the problem in the form of a short piece of code and explain
what you want to achieve in a bit more detail. (If there are functions
or types that are specific to that library, explain them if necessary.)
Jens <paule32.jk@gmail.com>: Oct 18 10:06AM +0200

Hello,
 
I am a member of a church organization for peoples with
some problems.
 
My hobby is it, to programming applications for computers.
I master me self in Delphi (beginning with Turbo Pascal 6/7,
GNU C/C++, and finally C++ Builder 1..6 (32-Bit).
 
I am able to download the Community Versions of Emberracdo
Delphi, and C++ Builder in both (32, and 64-Bit for Windows).
 
But I have to deal with C, and Pascal code twice.
But, I can only install Delphi, or C++ Builder.
But not the same RAD Tools together - and after a year, I have
to re-new the license, and re-install all Tools again.
 
This implicit the installing all the RAD Tools (Components)
that I had install before I use them.
And this is a nogo.
 
So, I back to days, as BORLAND came with his good 32-Bit Tools
of Delphi, and C++ Builder.
 
My first problem, in the past few days was, that I had a problem
to "parent window" a TSplitter (a component which can be used to
move parts of GUI components vertical, or horizontal on a desktop
window form (TForm), to make more visibility of the components on
the given/underlaying TSplitter componentes.
 
This problem was done by me, by experiment hours of wasteing time
and stressed lost of hair.
 
Okay, ...
 
Now, I have a problem, to "set" the Event Handler of a BORLAND
C++ Builder component (TSpeedButton) - a TSpeedButton is like a
normal Windows Desktop Application Button, except, it would be
*not* appear in the tabular order of selectable items of the
applications "tabable" components (ListBox, ComboBox, Button, ...)
 
I said: I have to deal with Pascal, and C Code ... :
I created a .DLL project under C++ Builder 6.0, compile it, and
place it in the directory of my application .exe binary.
 
As code/to comunicate with the C+++ .dll code, I export functions
from the .dll library, and import it in Delphi.
 
All code goes done.
Till, I would create a OnClick event on a TButton/TSpeedButton.
It seems, that I must have a class that decents from a TControl,
so, the VCL manager knows, which VMT (virtual method table)
proceure, or function can be called within this (TObject) class.
 
I have to use: extern "C" void foo(void) { /* ... */ }
 
because C++ mangles functions members in C++ and fit it in space
of the VMT's of it handled TClass.
So, I can not directly call mangled C++ functions in Delphi by
simply "import" them - this came to a caos of the differnt memory
system's between Delphi, and C++ Builder.
 
That's why, I use pointer between Delphi, and C++ Builder.
 
Okay, ...
 
Now, the question is: is it possible, to set a event handler on
the OnClick event of a TButton object without having implicit a
TObject inherited class ?
 
If the answer YES, then: How can this be done in C++ Builder ?
 
Under Delphi, I just assign it like:
 
....
btn := TButton.Create(AOwner);
btn.Parent := AOwner;
btn.OnClick := btnOnClick;
....
 
In C++ Builder 6.0, i try the similar same procedure, but I fail
with the code:
 
extern "C"
__declspec(dllexport) void
__stdcall foo(int owner)
{
....
TForm *form = new TForm((HWND)owner);
....
TButton *btn = new TButton(form);
btn->Parent = form;
btn->OnClick = btnOnClick; // <-- this fails
....
}
 
To make more sense in this posting, I can point You to my
StackOverflow/RetroComputing article with the followin URL:
 
https://retrocomputing.stackexchange.com/questions/25400/how-to-embeed-c-builder-6-32-bit-tframe-into-a-delphi-7-32-bit-application
 
This has not directly to do with my (second) part/question about
the described problem in this post.
But it depends on in future step's.
 
Thanks for reading, and helping hand.
Jens
Juha Nieminen <nospam@thanks.invalid>: Oct 18 09:27AM

> I am a member of a church organization for peoples with
> some problems.
 
I didn't ask for your life story. I asked for a short piece of code
and a question related to it.
David Brown <david.brown@hesbynett.no>: Oct 18 11:45AM +0200

On 18/10/2022 10:06, Jens wrote:
 
>   btn->OnClick = btnOnClick;  // <-- this fails
> ....
> }
 
In Delphi (Pascal), AFAIK class methods are treated as normal functions
with the class instance passed as the first parameter. You can assign
any function, including a freestanding function, to an "event" (that is,
a method function pointer) as long as the parameters match up. In C++,
a method function pointer is a different beast from a normal function
pointer because it can handle more complex class hierarchies than Object
Pascal supports (multiple inheritance, virtual inheritance, etc.).
 
Thus the assignment "btn->OnClick = btnOnClick" fails because a
pointer-to-function cannot be assigned to a pointer-to-member-function
pointer.
 
Far and away the simplest solution is to write a normal C++ Builder
style member function event handler for "btn->OnClick", which does
nothing but call the external function.
Bonita Montero <Bonita.Montero@gmail.com>: Oct 18 02:21PM +0200

Am 17.10.2022 um 22:51 schrieb Jens:
> global function (not a member of a class).
> How can I do this ?
 
> Thanks for ideas.
 
Have a lambda wich you can cast to a normal function pointer and
access local variables of the function by declaring them as either
static or thread_local depending on if the function needs to be
thread-safe. If you have some captures with that function pointer
this approach doesn't work since you can't cast lambdas with cap-
tures to normal function pointers.
 
Here's an example how to do this from another context:
 
a#include <iostream>
#include <vector>
#include <string>
#include <climits>
#include <link.h>
#include <dlfcn.h>
 
using namespace std;
 
int main()
{
thread_local vector<string> images;
dl_iterate_phdr(
[]( dl_phdr_info* image, size_t size, void* pFn ) -> int
{
try
{
if( *image->dlpi_name )
images.emplace_back( image->dlpi_name );
else
{
Dl_info dlInfo;
if( !dladdr( (void*)image->dlpi_addr, &dlInfo ) )
return 1;
char exePath[PATH_MAX];
if( !realpath( dlInfo.dli_fname, exePath ) )
return 1;
images.emplace_back( exePath );
}
return 0;
}
catch (...)
{
return 1;
}
return 1;
}, nullptr );
for( string const &image : images )
cout << "\"" << image << "\"" << endl;
}
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Oct 17 05:30PM -0700

On 10/17/2022 3:31 PM, Chris M. Thomasson wrote:
 
> 12 field lines per source
 
> https://fractalforums.org/gallery/1612-120522191048.png
 
> All in C++... ;^)
 
Damn it! wrong link:
 
https://fractalforums.org/gallery/1612-171022035603.png
"Chris M. Thomasson" <chris.m.thomasson.1@gmail.com>: Oct 17 05:32PM -0700

On 10/17/2022 5:30 PM, Chris M. Thomasson wrote:
 
>> All in C++... ;^)
 
> Damn it! wrong link:
 
> https://fractalforums.org/gallery/1612-171022035603.png
 
Sorry for the spam. At least you can block this damn thread. Here is the
link to my field with arrows:
 
https://fractalforums.org/gallery/1612-171022223014.png
 
Sorry for the multiple posts.
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.

No comments: