Nothing. this is merely a pointer to the data space of 'this' object, when in the code of that object, i.e. inside the methods declared in the class. Using it in the constructor has no relevance to your problem. The problem is that your call to LCD_Write_COM_DATA_t contains parameters that do not match the declaration of the method.
"contains parameters that do not match the declaration of the method."
Sorry, but it is just the opposite.
The method is OK, it's the wrong parameters I am passing in and I really do not know why.
I do not want contents , I need pointer to the array.
If I change the method I would have to rebuild it so it will take a contents, not pointer.
I'll take a look at the reference, thanks you for that.
Apparently compiler does not like to have both constructor and class variable names to be same
Not true, it does not matter. That is why you need to use the this pointer, so the compiler knows which variable you are referring to. Consider the following:
var1 = var1; // referring only to the parameter var1this->var1 = var1; // now it knows that the first one is the class variable.
None of which has any relevance to the issue you are describing. Forget about what goes on in the constructor, it is not connected to the probelm. You need to go back to the documentation and check carefully the definition of the TFT_LCD::LCD_Write_COM_DATA_t method.
You have to include some code inside the loop to recognise the keystroke or some other event to break out of the loop. If you add a getch then that would pause the loop until the keystroke is delivered. To get round this you can put that code in a separate thread and set a flag for the loop to check. You could also use _kbhit[^], although it has limitations.
Yeh, it seems to be the same thing. I checked under Linux with GCC and it works. On my point of view, Visual C++ runtime after exiting the main() destroys all the threads then all the global variables, instead of the opposite.
I am rebuilding my application and would like NOT to make local copies of parameters passed to the class constructor.
I have few methods which used to access application global variables , they are actually hardware "constants", and do not want to do that anymore.
I can rebuild these methods to include constructor passed parameters. no issue there.
But I was wondering if there is an another way to access the constructor parameters without adding them to the methods parameters or making local copies.
I hope I have explained my dilemma , if not , sorry.
Thanks for replies.
It may be stupid, but that is what I am trying to avoid.
Now I would have "someParam" - actually global array and a class copy of the same so it can be accessed by class methods.
I am trying to save some memory of embedded processor.
Kinda of wishful thinking ahead.
I won't get to upset if I need to make a local copies.
Would using "this" pointer work making local copy?
I just tryied "standard" this.name = name but could not make it work on pointers.
I guess I am still struggling with using pointers.
I have decided to KISS and I'll be making copies of the parameters using "this" pointer.
One question remains - since all of the parameaters passed are de facto constants - harwdware pins, LCD size etc. and won't be modified by the class, why can't I just use "this>LCD_x_size" as variable instead of "this->LCD_x_size = LCD_x_size" Now the class local varaible is "LCD_x_size".
And yes, I read somewhere that using same symbols for "name" and "variable" is OK.
Confusing, but OK.
I am looking for the best Way/Strategy to "Continuously read data from the HW in real-time and draw some GUI-diagram in Parallel". Performance would be a big matter here since the graph has to be drawn in real-time.
Its just coming to my mind about 1) creating 1 worker-thread for reading process, and 2) another for GUI drawing.
But I am looking for perfection and suggestions here.
1) Is there any specific Design-Pattern that would fit this?. If so, please suggest.
2) Whats the best way(container) to read data by the worker-thread and keep it for the GUI-thread to process. FIFO? or some other class?
Thanks in advance for your suggestion and advice.
Last Visit: 31-Dec-99 18:00 Last Update: 10-Apr-21 4:45