>-----Original Message----- >From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] >Sent: 15 February 2005 12:48 >To: Microcontroller discussion list - Public. >Subject: Re: [PIC] Bug in Microchip mcc18 std library? > > > >----- Original Message ----- >From: "Wouter van Ooijen" >To: "'Microcontroller discussion list - Public.'" >Sent: Tuesday, February 15, 2005 3:23 AM >Subject: RE: [PIC] Bug in Microchip mcc18 std library? > > >>> A quick rat hole - does C18 not allow any pointer to freely >point to >>> ROM and RAM ? Would explain some strange constructs in the C18 >>> program that >>> I have been converting ! >> >> AFAIK is does not. >> >> Wouter van Ooijen > >It does not, and for a very good reason. Since ROM and RAM are >completely >separate address spaces, that don't even have the same pointer >width (RAM = >12 bits, ROM = 16 or 22? bits), there would be quite a bit of >overhead to >create 'universal' pointers. I suppose it could be done using a 24-bit >format where the upper bit indicated which memory type to >access, but I just >think that would be ugly (and slow). But speed may be an acceptable trade off sometimes for the convienience of a function that can accept a pointer to either data or program memory. HiTechs compiler can do this, but with a small limitation. If the pointer value is below the maximum data memory address, it is deemed to be pointing to data memory, otherwise it's pointing to program memory. Of course this does introduce some overhead and is problematic if you want to access low program memory with the same pointer. However, the linker will always place constant data above this address, so for the majority applications this solution works very well. Regards Mike ======================================================================= This e-mail is intended for the person it is addressed to only. The information contained in it may be confidential and/or protected by law. If you are not the intended recipient of this message, you must not make any use of this information, or copy or show it to any person. Please contact us immediately to tell us that you have received this e-mail, and return the original to us. Any use, forwarding, printing or copying of this message is strictly prohibited. No part of this message can be considered a request for goods or services. ======================================================================= -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist