[Color Computer] [Coco] FYI - 6809 GCC

James Diffendaffer jdiffendaffer at yahoo.com
Mon May 8 10:41:18 EDT 2006


>Strange choice making 'int' be 8-bit instead of 16-bit. I can
>understand the reasoning that the word size of the 6809 is 8-bit, but
>the counterargument that a C int is commonly assumed to be at least
>16-bits holds a lot more weight for me since more legacy code is
>likely to "just work" without changes.

I thought 8 bit ints was an unwise choice due to the amount of code
that will break.  On the other hand, code that doesn't break will be
more efficient.  

The compiler industry went through a phase where code optimizers would
break code a lot for the sake of faster executables.  Now they err on
the side of working code.  

I think it would be better to have all code work.  I'm not sure if 8
bit ints conforms to ANSI or not either.  I think it would be better
to just suggest people define and use BYTE/UBYTE rather than int if
they want the best code.  If you can't use int for existing code you
may have to use long just to get it to work and that could be slower
if longs are 32bit.  

This also requires the link libs to be compatible with whatever size
int the compiler supports.  If OS-9 ints were 8 bit this would
actually be an advantage... if not it means rewriting a lot of library
routines. 

But then any compiler is better than no compiler.  The version I was
working on is sitting on a computer that has no CPU or RAM and it
still needed some stack related stuff finished before I can even test
it.  Perhaps some of what I learned about the newer GCC could be put
to use helping them get this version working properly with the 4.X.X
now that I have some time again.  


>Nevertheless, truly portable code makes no dependencies on the default
>word sizes of their C compiler, and uses header files to define fixed
>size types (like UINT16 for example).

I think it's safe to say a lot of code assumes int will handle signed
numbers larger than 128 and unsigned numbers larger than 255.  Even a
graphics routine using ints for x and y will exceed that limit when
drawing on a CoCo 1/2 hi-res screen.
The compiler could be modified to build with 8 or 16 bit int size
handling.  







------------------------ Yahoo! Groups Sponsor --------------------~--> 
Protect your PC from spy ware with award winning anti spy technology. It's free.
http://us.click.yahoo.com/97bhrC/LGxNAA/yQLSAA/CFFolB/TM
--------------------------------------------------------------------~-> 

Brought to you by the 6809, the 6803 and their cousins! 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/ColorComputer/

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

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the Coco mailing list