Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C > Re: ****tabilit...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 7 of 36 Topic 26061 of 26972
Post > Topic >>

Re: ****tability: Harmony between PC and microcontroller

by Keith Thompson <kst-u@[EMAIL PROTECTED] > May 5, 2008 at 09:28 AM

"Bartc" <bc@[EMAIL PROTECTED]
> writes:
> "Tomás Ó hÉilidhe" <toe@[EMAIL PROTECTED]
> wrote in message 
> news:582c24fa-1cc4-49f0-8ca7-171928a1a38e@[EMAIL PROTECTED]
>>
>> I'll try to summarise this as best I can, as my last thread wasn't
>> very to-the-point:
>>
>> The C Standard says the following two things:
>>
>> * int is the natural integer type for the system.
>> * int must be at least 16-Bit.
>>
>> Now the problem here is that these two criteria conflict if the
>> natural type for the system is in fact 8-Bit, which is the case with
>> many microcontrollers today.
[...]
>
> It doesn't seem an insurmountable problem.
>
> If you want a default int size that is best for your cpu, try something 
> like:
>
> typedef unsigned char uint;      /* Or uint_fast8_t etc. */
> typedef signed char sint;
>
> Then use uint and sint everywhere in place of unsigned/signed int.
>
> When moving to a bigger processor, you need to change those two lines or
use 
> some conditional compilation tricks.

*Please* don't call them "uint" and "sint".

What the name "uint" says to me is "unsigned int, but I care more
about saving a few keystrokes than writing clear code"; likewise for
"sint".  The only thing worse than typedef'ing "unsigned int" to
"uint" is typedef'ing something else to "uint".  I understand that
"uint" is intended to convey "unsigned integer" rather than "unsigned
int", but that's not how it comes across.

If you want to call them, say, "small_signed" and "small_unsigned",
that's fine.

-- 
Keith Thompson (The_Other_Keith) <kst-u@[EMAIL PROTECTED]
>
Nokia
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"
 




 36 Posts in Topic:
Portability: Harmony between PC and microcontroller
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-04 18:16:43 
Re: Portability: Harmony between PC and microcontroller
Jack Klein <jackklein@  2008-05-04 21:42:18 
Re: Portability: Harmony between PC and microcontroller
CBFalconer <cbfalconer  2008-05-05 02:45:49 
Re: Portability: Harmony between PC and microcontroller
Martin Ambuhl <mambuhl  2008-05-05 03:38:34 
Re: Portability: Harmony between PC and microcontroller
CBFalconer <cbfalconer  2008-05-05 19:03:03 
Re: Portability: Harmony between PC and microcontroller
"Bartc" <bc@  2008-05-05 10:07:18 
Re: Portability: Harmony between PC and microcontroller
Keith Thompson <kst-u@  2008-05-05 09:28:46 
Re: Portability: Harmony between PC and microcontroller
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-05 06:57:18 
Re: Portability: Harmony between PC and microcontroller
CBFalconer <cbfalconer  2008-05-05 19:09:27 
Re: Portability: Harmony between PC and microcontroller
Chris Dollin <chris.do  2008-05-06 12:33:20 
Re: Portability: Harmony between PC and microcontroller
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-06 05:20:29 
Re: Portability: Harmony between PC and microcontroller
Chris Dollin <chris.do  2008-05-06 13:40:21 
Re: Portability: Harmony between PC and microcontroller
Eric Sosman <Eric.Sosm  2008-05-06 10:53:13 
Re: Portability: Harmony between PC and microcontroller
Keith Thompson <kst-u@  2008-05-06 12:28:04 
Re: Portability: Harmony between PC and microcontroller
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-06 06:06:35 
Re: Portability: Harmony between PC and microcontroller
Chris Dollin <chris.do  2008-05-06 16:16:18 
Re: Portability: Harmony between PC and microcontroller
"soscpd@[EMAIL PROTE  2008-05-06 07:32:43 
Re: Portability: Harmony between PC and microcontroller
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-06 07:49:48 
Re: Portability: Harmony between PC and microcontroller
"soscpd@[EMAIL PROTE  2008-05-06 09:40:46 
Re: Portability: Harmony between PC and microcontroller
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-06 10:19:09 
Re: Portability: Harmony between PC and microcontroller
"Herbert Rosenau&quo  2008-05-06 19:01:56 
Re: Portability: Harmony between PC and microcontroller
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-06 15:29:56 
Re: Portability: Harmony between PC and microcontroller
santosh <santosh.k83@[  2008-05-17 01:14:57 
Re: Portability: Harmony between PC and microcontroller
jacob navia <jacob@[EM  2008-05-16 22:24:28 
Re: Portability: Harmony between PC and microcontroller
Ben Pfaff <blp@[EMAIL   2008-05-16 13:42:16 
Re: Portability: Harmony between PC and microcontroller
jacob navia <jacob@[EM  2008-05-17 01:22:10 
Re: Portability: Harmony between PC and microcontroller
Ian Collins <ian-news@  2008-05-17 09:28:15 
Re: Portability: Harmony between PC and microcontroller
soscpd <soscpd@[EMAIL   2008-05-06 20:47:09 
Re: Portability: Harmony between PC and microcontroller
Bart van Ingen Schenau &l  2008-05-07 06:05:12 
Re: Portability: Harmony between PC and microcontroller
Flash Gordon <spam@[EM  2008-05-07 20:01:34 
Re: Portability: Harmony between PC and microcontroller
"robertwessel2@[EMAI  2008-05-07 11:45:58 
Re: Portability: Harmony between PC and microcontroller
Bart van Ingen Schenau &l  2008-05-08 02:46:03 
Re: Portability: Harmony between PC and microcontroller
Bart van Ingen Schenau &l  2008-05-08 03:14:57 
Re: Portability: Harmony between PC and microcontroller
=?ISO-8859-1?Q?Tom=E1s_=D  2008-05-16 16:12:50 
Re: Portability: Harmony between PC and microcontroller
Chris H <chris@[EMAIL   2008-05-17 09:00:09 
Re: Portability: Harmony between PC and microcontroller
Ian Collins <ian-news@  2008-05-17 20:18:27 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Jul 25 21:34:37 CDT 2008.