Need 286 "C" benchmark

Guy Harris guy at sun.uucp
Thu May 30 15:46:10 AEST 1985

> As for "getting by", I assume you consider it a feature that your
> compiler drags along an extra 16 bits when you don't need it. When I need
> long ints, I use long ints. How do define 16 bit numbers? short? and if
> so what is a byte in your compiler?

Two points:

1) Not all 68000 C implementations have 32-bit "int"s.  You do have
to take more care to be more type-correct when writing code.  I consider
this a feature, not a bug...

2) Well, the C compiler on the 68000-based UNIX machine this is being typed
on supports 32-bit "int"s and defines 16-bit numbers as "short" and a byte
is 8 bits - it can be called "char" or "unsigned char" depending on whether
you want sign extension.  What's so hard about defining 16-bit numbers on
32-bit "int" implementations of C?  The VAX has done it for quite a few
years now.

3) 16-bit "int"s on machines with large address spaces can make it a pain to
deal with large lumps of data.  For instance, the V7/S3 "nm" loses big,
because it uses "realloc" to grow its in-core copy of the symbol table.
"realloc" takes an "unsigned int" as its argument; get more than 64KB worth
of symbol table and you lose (yes, there do exist programs which break
this).  Unfortunately, C doesn't have a way of saying "int big enough to
hold the size of the address space, in bytes" nor is there any standard system
include file defining such a type.

> Here we are discussing compilers again, Microsoft has yet to release a
> compiler that can deal with large arrays, the 286 has a 1Gbyte virtual
> address space and hence plenty of room.  I personally can write the
> "benchmark" in assembly quite easily, again the COMPILER can't hack it
> but the chip can.

Why is it so hard to write compilers which can handle that 1GB virtual
address space?  It's much easier on the 68000.  How easy is it to write a
compiler which can handle 65,537-byte arrays almost as efficiently as it
handles 65,536-byte arrays?  (For that matter, how easy is it to handle
128KB contiguous arrays of bytes, e.g. the screen that what I'm typing
is appearing on?)  The compiler may have trouble hacking it because the chip
makes it difficult to handle.

	Guy Harris

More information about the Comp.lang.c mailing list