This Forum is Dedicated For all The Object Oriented PIC Lovers .......... The concept behind OOPic is straight forward. Use preprogrammed multitasking Objects from a library of highly optimized Objects to do all the work of interacting with the hardware. Then write small scripts in Basic, C, or Java syntax styles to control the Objects. During operation, the Objects run continuously and simultaneously in the background while the scripts run in the foreground telling the objects what to do.

Monday, March 10, 2008

Re: [oopic] more debugging

On Mar 10, 2008, at 1:16 AM, Andrew Porrett wrote:

> At 01:26 PM 3/9/2008, Brian Lloyd wrote:
>> I am aware of the differences between signed and unsigned types. (I
>> must admit to being surprised to see that type char is signed. That
>> makes no sense to me.)
>
> char defaulting to signed is classic / standard behaviour for real C
> compilers. It dates from the early days when memory space was tight
> and using 8 bit variables was common.

Yes. I spent more time writing in Pascal where char is a character and
must be assigned character data. Byte, word, dword, long, etc., were
unsigned types. Int was signed.

> You can't calculate a negative
> difference with unsigned values, which is why programmers normally
> use signed variables (hello Year 2038 problem!)

I agree.

> When working with real compilers, I always define my own unsigned 8
> bit datatype:
>
> typedef unsigned char BYTE; // portable unsigned 8 bit data type

Yes.

> It seems correct to me for "byte", "word", "dword", etc. datatypes to
> be unsigned. I tend to equate them with memory addresses, block
> sizes, and so on - things that can never be negative.

I agree 100%.
>
>
> char, int, long - these are the signed counterparts. It works for me.

My only disagreement would be to use char as signed. It should be
reserved for character data, e.g. "char foo[10]" would be a string of
length 10. But then, I have always been a proponent of strongly-typed
languages. It catches a lot of silly errors.

So clearly, I am right and everyone else is wrong. ;-)

Thanks for the response Andy.

Brian Lloyd
Granite Bay Montessori School 9330 Sierra College Bl
brian AT gbmontessori DOT com Roseville, CA 95661
+1.916.367.2131 (voice) +1.791.912.8170 (fax)

PGP key ID: 12095C52A32A1B6C
PGP key fingerprint: 3B1D BA11 4913 3254 B6E0 CC09 1209 5C52 A32A 1B6C



Yahoo! Groups Links

<*> To visit your group on the web, go to:

http://groups.yahoo.com/group/oopic/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:

http://groups.yahoo.com/group/oopic/join

(Yahoo! ID required)

<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:

http://docs.yahoo.com/info/terms/

No comments: