Click here to Skip to main content
14,579,546 members

C / C++ / MFC

 
GeneralRe: Shift + VK_LEFT Pin
_Flaviu21-Sep-15 22:13
Member_Flaviu21-Sep-15 22:13 
AnswerRe: Shift + VK_LEFT Pin
Richard MacCutchan20-Sep-15 22:32
mveRichard MacCutchan20-Sep-15 22:32 
GeneralRe: Shift + VK_LEFT Pin
_Flaviu20-Sep-15 22:53
Member_Flaviu20-Sep-15 22:53 
GeneralRe: Shift + VK_LEFT Pin
Richard MacCutchan20-Sep-15 23:05
mveRichard MacCutchan20-Sep-15 23:05 
GeneralRe: Shift + VK_LEFT Pin
_Flaviu20-Sep-15 23:15
Member_Flaviu20-Sep-15 23:15 
Question[SOLVED?] Using "this" pointer to "copy" pointer Pin
Vaclav_19-Sep-15 17:11
MemberVaclav_19-Sep-15 17:11 
Apparently compiler does not like to have both constructor and class variable names <b>to be same</b>.

this->variable_name = variable_name



I am using "this" pointer to pass / copy parameters passed to class constructor so they can be accessed by class methods.
I have managed to do it for simple int
Here is the declaration of int disp_x_size_, disp_y_size_; in the class


int disp_x_size_, disp_y_size_; //size x y
int *ControlPin; // control pins array
int *DB; // data bus pins array

and here is how I use "this" pointer in the constructor :

this->disp_x_size_ = disp_x_size_; // class local variable = paramater passed to constructor

works fine.

Now I tried to do same for passed pointer - for ControlPin declaration see above and here is the "this" pointer code

this->ControlPin = ControlPin;
this->DB = DB;

Compiles OK , but when I try to use it all I am getting is the actual content of the first member of the array. I have limited ways to check the pointer.

When I try to actually use it in this function
LCD_Write_COM_DATA_t(ControlPin, DB , (uint32_t)0x44, (uint32_t) ((x2 << 8) + x1),16); // horizontal RAM address position

it does not compile with the following error

C:\DOCUME~1\Vaclav\LOCALS~1\Temp\build5821005168044960715.tmp\sketch\A.h: In member function 'void TFT_LCD::setXY(word, word, word, word)':
C:\DOCUME~1\Vaclav\LOCALS~1\Temp\build5821005168044960715.tmp\sketch\A.h:9297:87: error: no matching function for call to 'TFT_LCD::LCD_Write_COM_DATA_t(<b>int*&, int*&,</b> uint32_t, uint32_t, int)'
LCD_Write_COM_DATA_t(ControlPin, DB , (uint32_t)0x44, (uint32_t) ((x2 << 8) + x1),16); // horizontal RAM address position

I believe that instead of simple int* I am passing the contents of the first array member int*&
which obviously is not the TYPE expected by the template function.( And I can verify that)

BTW that function works when correct TYPE pointer is passed to it.

I basically need someone to explain to me what am I doing wrong using "this" pointer that I end up with int*& instead of just int*.

I hope it makes sense, if not I can explain it more. But don't ask for full code - it is now over 10000 lines of giant mess

Appreciate any help, as always

Cheers
Vaclav

-- modified 20-Sep-15 11:25am.
AnswerRe: Using "this" pointer to "copy" pointer Pin
Richard MacCutchan19-Sep-15 21:10
mveRichard MacCutchan19-Sep-15 21:10 
GeneralRe: Using "this" pointer to "copy" pointer Pin
Vaclav_20-Sep-15 3:02
MemberVaclav_20-Sep-15 3:02 
GeneralRe: Using "this" pointer to "copy" pointer Pin
Richard MacCutchan20-Sep-15 6:42
mveRichard MacCutchan20-Sep-15 6:42 
AnswerRe: [SOLVED?] Using "this" pointer to "copy" pointer Pin
Richard MacCutchan20-Sep-15 6:52
mveRichard MacCutchan20-Sep-15 6:52 
QuestionHow to break an infinite loop Pin
Mohamed Nehad18-Sep-15 16:57
MemberMohamed Nehad18-Sep-15 16:57 
AnswerRe: How to break an infinite loop Pin
Richard MacCutchan18-Sep-15 21:43
mveRichard MacCutchan18-Sep-15 21:43 
AnswerRe: How to break an infinite loop Pin
Fuseteam19-Sep-15 8:36
MemberFuseteam19-Sep-15 8:36 
QuestionDefine 'Enter' key in C Pin
Mohamed Nehad18-Sep-15 16:52
MemberMohamed Nehad18-Sep-15 16:52 
QuestionRe: Define 'Enter' key in C Pin
Richard MacCutchan18-Sep-15 21:44
mveRichard MacCutchan18-Sep-15 21:44 
AnswerRe: Define 'Enter' key in C Pin
Mohamed Nehad20-Sep-15 12:04
MemberMohamed Nehad20-Sep-15 12:04 
QuestionCall to std::thread::join() in the destructor of a global variable Pin
dchabaud17-Sep-15 3:49
Memberdchabaud17-Sep-15 3:49 
AnswerRe: Call to std::thread::join() in the destructor of a global variable Pin
CPallini17-Sep-15 5:13
mveCPallini17-Sep-15 5:13 
GeneralRe: Call to std::thread::join() in the destructor of a global variable Pin
dchabaud17-Sep-15 5:27
Memberdchabaud17-Sep-15 5:27 
QuestionRe: Call to std::thread::join() in the destructor of a global variable Pin
CPallini17-Sep-15 5:32
mveCPallini17-Sep-15 5:32 
AnswerRe: Call to std::thread::join() in the destructor of a global variable Pin
dchabaud17-Sep-15 20:57
Memberdchabaud17-Sep-15 20:57 
GeneralRe: Call to std::thread::join() in the destructor of a global variable Pin
CPallini17-Sep-15 22:05
mveCPallini17-Sep-15 22:05 
Questionaccess violation with std::map (VS2015) Pin
Member 853403517-Sep-15 3:41
MemberMember 853403517-Sep-15 3:41 
QuestionRe: access violation with std::map (VS2015) Pin
David Crow17-Sep-15 5:06
MemberDavid Crow17-Sep-15 5:06 
QuestionRe: access violation with std::map (VS2015) Pin
CPallini17-Sep-15 5:09
mveCPallini17-Sep-15 5:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.