YCPU | imaginary 16-bit cpu | Emulator library
kandi X-RAY | YCPU Summary
kandi X-RAY | YCPU Summary
An imaginary 16-bit cpu, with a complete specification, emulator, assembler, and disassembler, in C#.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of YCPU
YCPU Key Features
YCPU Examples and Code Snippets
Community Discussions
Trending Discussions on YCPU
QUESTION
Problem
I have an array of member function pointers that I assign at run-time. I am getting a compile-time error when attempting to call them:
pointer to member type 'void (YCPU::)(uint16_t)' {aka 'void (YCPU::)(short unsigned int)'} incompatible with object type 'YCPUInstruction'`
I'm having trouble understanding the proper syntax to call the pointers.
Code and Problem Details
I have a struct YCPUInstruction
that stores two member function pointers. These function pointers point to member functions inside YCPU
. I store an array of YCPUInstructions
and during initialization I call initialize which assigns these pointers to the correct member function.
Member function pointers and YCPUInstruction:
...ANSWER
Answered 2021-Mar-09 at 17:49The left operand of .*
must refer to / the left operand of ->*
must point at an object of the member function's containing class. The right operand can be any expression which gives the pointer-to-member value.
The containing class of the member functions you're using is YCPU
, so it's not correct to have the YCPUInstruction
as a left operand. I see that your expression is within another member function of YCPU
, so assuming you want to use *this
as the YCPU
the function is called on, you want this->*
. The following expression can be an ordinary .
or ->
expression to just get, not call, the pointer-to-member-function value from the YCPUInstruction
. Since the precedence of .*
and ->*
are strange, excessive parentheses are quite often necessary and always recommended.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install YCPU
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page