[GSOC]Progress Report of MMU support project

Peter Dufault dufault at hda.com
Mon Jul 11 13:20:21 UTC 2011


On Jul 11, 2011, at 8:54 , Quanming Shi wrote:

>  " size_t "  is defined in newlib library,  included from <inttypes.h>
It's in <stddef.h>.  In general you want to use size_t when you are referring to the size of an object, that is, anything that would be returned by the sizeof operator.

I personally avoid using plain old "int" or "unsigned" in interfaces.  I prefer to:

- Use size_t if something refers to a size;
- Use uint32_t, int32_t and friends from <inttypes.h> when I know the size of a data type (I know they're defined to be in stdint.h but I use inttypes.h);
- Make up a typedef for something that has no natural data size.

I'd also use "void *" instead of "char *" for your addresses, for example:

rtems_status_code rtems_mprot_alut_search(void *addr, rtems_mprot_alut **p_ret);

It also makes sense to change the "void *" to "const void *" if your library never needs to write to those addresses. 
 
Peter
-----------------
Peter Dufault
HD Associates, Inc.      Software and System Engineering

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20110711/fcccbecc/attachment-0001.html>


More information about the users mailing list