| ??? 06/11/01 12:06 Read: times |
#12381 - RE: keil C: abstarct pointer |
First, I presume that you're happy with the general concepts of pointers in 'C'.
There is a slight complication when 'C' is applied to the 8051, since the Compiler somehow needs to know not only the address of an object, but also in which address space is resides - CODE, DATA, IDATA, PDATA or XDATA. Keil have provided 2 mechanisms to support this: 1. "Memory-Specific" pointers, where the address space is stated explicitly in the declaration; eg, char data *str; /* ptr to string in data */ int xdata *numtab; /* ptr to int(s) in xdata */ long code *powtab; /* ptr to long(s) in code */ 2. "Generic" pointers, which can point to data in any address space. Their use of the term "Generic" is unfortunate, since standard 'C' terminology uses it with a different meaning! In standard 'C', a "Generic Pointer" is a pointer which points to any arbitrary address without specifying a data type; in ANSI 'C', it is used thus: void *p // p is a generic pointer In ANSI 'C', "any pointer can be cast to void * and back again without loss of information" (K&R Chapter 5). Keil use the term Abstract Pointer for this. In Keil 'C', it is not always valid to convert between pointers to different address spaces (you can't convert a CODE pointer to an XDATA pointer!) - that's what the section in the C51 manual is discussing. Hope that helps? |
| Topic | Author | Date |
| keil C: abstarct pointer | 01/01/70 00:00 | |
| RE: keil C: abstarct pointer | 01/01/70 00:00 | |
| RE: keil C: abstarct pointer | 01/01/70 00:00 | |
| RE: keil C: abstarct pointer | 01/01/70 00:00 | |
| RE: keil C: abstarct pointer | 01/01/70 00:00 | |
| RE: keil C: abstarct pointer | 01/01/70 00:00 | |
| RE: keil C: abstarct pointer | 01/01/70 00:00 | |
| RE: keil C: abstarct pointer | 01/01/70 00:00 | |
RE: keil C: abstarct pointer | 01/01/70 00:00 |



