Vickynathan wrote:
> The following code snippet works. I wonder how ? ( this is a code for
> microcontroller )
By saying it works, I guess you mean it compiles, however if it is for a
microcontroller I wonder if you are using a compiler that specifically
targets that hardware. Many compilers for microcontrollers include
hardware specific extensions.
>
> void main (void){
So the above line suggests that you are not using a standard conforming
implementation. At a guess you are using an extended implementation for
a free-standing system.
>
> unsigned char xdata * data pwrite;
as you probably realise the above line (and the next one) do not parse
as C (though it is conceivable that xdata and data are invocations of a
#define
e.g.
#define xdata volatile
#define data const
now pwrite is declared to be a const pointer to a volatile unsigned char.
> unsigned char code * data pread;
however my best guess is that xdata and code are system specific
qualifiers selecting memory areas.
> unsigned char test_array [16];
> unsigned char temp;
> ....
> ....
> ....
>
> pwrite = (unsigned char xdata *) Scratch_Flash_Addr ; // I have
> never seen such an initialization ??
Looks like pwrite is being set to point to some flash memory being used
as a scratch pad.
> pread = my_array ;
where does my_array come from
>
> .....
> .....
>
> for ( i=0; i< sizeof( my_array); i++ ){
> .....
> temp = pread[i]; // How is this possible
as pread is a pointer to some form of unsigned char memory block
pread[i] is a perfectly reasonable unsigned char (pread[i] is equivalent
to *(pread + i) And there is your indirection.
> without an indirection operator ?
> .....
> pwrite[i] = temp; // Again no indirection
> operator ??
> .....
> }
>
--
comp.lang.c.moderated - moderation address: clcm@
plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry
--
comp.lang.c.moderated - moderation address: clcm@
plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.