>-----Original Message----- >From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] >Sent: 15 February 2005 15:27 >To: Microcontroller discussion list - Public. >Subject: RE: [PIC] Bug in Microchip mcc18 std library? > > >> In Hitech the only type of pointer that can point to both data and >> program memory are pointers to const data types. Are you >saying it's >> preferable to have two different functions to deal with pointers to >> data/program memory rather than one function that can work with >> either? e.g. puts() which is used by printf etc. As sson as you >> start splitting >> things up like this the compiler moves away from ANSI >> compatibility and >> you have to add all sorts of kludges to get things working. >> > >The ANSI standard C is designed around an architecture which >makes no distinction in memory between data and code space; >the PIC isn't like that. Whilst it's possible to create an >ANSI standard compiler for a PIC, the architectural quirks, >IMO, mean that is less than desireable. > >Yes, the side effect is the need for different std functions >to cope with different scenarios, but at least that makes the >programmer aware that there is a very real difference. When you declare data structures you have to tell the compiler if they are located in program memory or in data memory. You then have a handy pointer that can work with either type of data. Obviously it is a pointer to a const data type, so the data cannot be modified via that pointer even if it is in data memory. The whole idea is that a function using this pointer dosen't have to be explicitly told where the data is, it just works. Wheres the problem exactly? 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