Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
generic pointer physically located in xdata space..
unsigned char*__xdata p;
pointer physically in internal ram pointing to object in external ram..
__xdata unsigned char* __data p;
Nice, but those do not quite match with the original "code"..
Kinda!! There is a command on the 8051 to use external memory, data memory or code memory... All these do (as you so rightly say ) is include the High address register if need be...Fast google tells me that "xdata" is a 16bit address base. It tells the compiler to use 16bit pointers. Or something that nature..
I agree. C also has arrays which are much easier for the average joe to follow and as I understand it should generate the same machine code.From experience...excessive use of pointers is a way to tell one programmer you are better than the next....
From experience...excessive use of pointers is a way to tell one programmer you are better than the next....
From experience...excessive use of pointers is a way to tell one programmer you are better than the next....
Damn!! That's where I'm going wrong...NorthGuy said:Good programmers do not like their code being looked at
Damn!! That's where I'm going wrong...
It is not often I disagree with you but this is major! LOLYou think they are showing prowess??
I don't think that!! All you need to do is look at ASM code written by a professional against code written by a novice.
The advanced coder will code using indirect access, for speed and agility... Pointer make access simpler once you know how to use them. Pointers are, after all, using indirect addressing mode...
3V0 said:Anyway there is no point in using pointers in c where you can use an array. Pun intended.
Some people just make every variable "global".. This is the case with small ram deficient micro's. I entirely agree that, in these situations, pointers are not required as you have no stack to worry about... Having said that, if you are used to using them, what does it matter if you do use them..For example, if you have a variable and a routine that needs to modify the variable, instead of passing the variable to the routine, you pass the pointer to the variable. I have absolutely no idea how you can do this simple thing without pointers.
void LCDprint(const char * str)
{
while(*str != 0)
LCDdata(*str++);
}
void LCDprint(void)
{
char x = 0;
while(LCDbuf[x] != 0)
LCDdata(LCDbuf[x++]);
}
Some people just make every variable "global".
void process_string_before_displaying(char * str) {
// complicated conversion here
}