Newsgroups: | comp.arch,comp.compilers |
From: | bret@icicle.winternet.com (Bret Indrelee) |
Keywords: | optimize |
Organization: | StarNet Communications, Inc |
References: | 94-10-108 94-10-141 |
Date: | Sun, 23 Oct 1994 16:54:17 GMT |
Andy Glew <glew@ichips.intel.com> wrote:
>I am aware of the K&R rule that structure elements be in increasing
>order of address. But, since the contiguity requirement has been
>dropped, and since different machines have different padding rules,
>what value does the address ordering rule have? Even network header
>code cannot be written portably using structures to access data
>structures placed in memory from DMA devices.
Actually, I've had good luck with just filling my structures with
proper padding in order to use structures for register access. If
the structure is already aligned, I haven't found any compilers that
insert padding.
It may not be strictly compliant code, but it is close enough to
work on several workstations. If you were to allow re-ordering,
this sort of stuff would probably break on a large share of the
workstations.
Even though almost all the workstation venders seem to hate it,
I find that memory mapped I/O is a lot faster to write and debug
than the alternatives I've seen.
If reordering does get into the next rev of ANSI C, I hope they
will also give us the constructs to force alignment to a certain
boundary, check alignment, and also declare something as a
hardware port. All of these things are done in device drivers.
Something a little stronger than the volatile type modifier, that
is.
-Bret
--
Bret Indrelee
bret@winternet.com
--
Return to the
comp.compilers page.
Search the
comp.compilers archives again.