piclist 2001\06\28\063616a >
Thread: const pointers in hitech C
www.piclist.com/techref/microchip/languages.htm?key=c
flavicon
face BY : mikeTakeThisOuT@whitewing.co.uk



How do I do this in Hitech C

I'm trying to pass a const pointer to a long, to allow a sub-procedure
access to a local variable of its caller without the overhead of
passing the pointer (I would hope the compiler would notice the
pointer is constant and  so not create code to pass it):  
I tried this....

void proc1(const long *var)
{
var++;
}

void proc2;
{
long count;
proc1(&count);
}


Looking at the code generated, proc1 is incrementing the pointer, not
the contents of count - I probably heva the syntax wrong  -  what is
the correct C syntax for the above ? Can what I'm trying to do actually be done ?

I know I could use a global, but that wastes RAM, as locals are
overlapped.
--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


<a10mjt8gfjcklu4t9csf2vqhgah1pbotoo@4ax.com> quoted-printable

See also: www.piclist.com/techref/microchip/languages.htm?key=c
Reply You must be a member of the piclist mailing list (not only a www.piclist.com member) to post to the piclist. This form requires JavaScript and a browser/email client that can handle form mailto: posts.
Subject (change) const pointers in hitech C

month overview.

new search...