Afficher un message
Vieux 18/10/2007, 12h23   #3
Spiros Bousbouras
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: C both slow and memory-hungry for embedded systems?

On Oct 18, 10:21 am, Martin Wells <war...@eircom.net> wrote:
> Spiros:
>
> > > Standarising C in such a way that int is at least 16-Bit, has this
> > > made C both slow and memory-hungry for embedded systems programming?

>
> > What's stopping you from using (unsigned) char on such systems ?

>
> I write fully-portably in C89, paying no attention to the particulars
> of the platform. If I was to start using char instead of int, I'd
> introduce inefficiency on systems whose optimal int type is >= 16
> bits.


Not necessarily. It is entirely possible that a compiler will
represent internally a char using whichever integer type is the
fastest in the platform.

> I think a fair few embedded programmers are starting to use things
> like int_fastest_at_least_8 which are defined in C99.
>
> To be a fully-portable programmer both for PC's and for embedded
> systems, should we start using these <stdint.h> types?


If you want to be fully portable *and* the fastest possible *and* pay
no attention to the particulars of the platform then I guess you
would have to use int_fast8_t. If on the other hand you are willing
to pay just a bit of attention to the particulars of the platform
then you could do something like
typedef char my_int_fast_8_t
and replace char in the line above by whatever type is the fastest
in each platform.


  Réponse avec citation
 
Page generated in 0,06098 seconds with 9 queries