[En-Nut-Discussion] Bugs in Uart.c

Henrik Maier hmlists at focus-sw.com
Thu Mar 27 02:40:11 CET 2008


> -----Original Message-----
> Nathan Moore schrieb:
> Unfortunately it's unsigned long int. I googled for size_t and basically
> it seems to be "some kind" of unsigned integer. This is fine if you do
> have performance, but if every tick count's and registers are quite
> valuable IMHO one should know how a variable looks like. (I hate
> decisions which depend on the mood of your compiler. I therefore
> generally prefer uint8_t, etc. Even char is defined mostly signed.)

size_t on an AVR is a 16-bit unsigned int. 

Using an 8-bit value would limit your API to only handle data chunks of 255
bytes. This may not be a problem for your application but would complicate
matters for other applications.

I believe Nut/OS has a good balance between optimisation for small MCUs
while still following accepted standards, offering a convenient API and
being reasonable portable.

If you start optimising too much towards a particular architecture or
application, you will lose portability or your code may only work if certain
assumptions are met. 


Henrik
http://www.proconx.com





More information about the En-Nut-Discussion mailing list