* casting bug/feature?
@ 1993-12-18 3:35 Merritt
0 siblings, 0 replies; only message in thread
From: Merritt @ 1993-12-18 3:35 UTC (permalink / raw)
While porting a PC application to OSF-1 on the DEC Alpha, I ran into what
I thought was an OSF-1 bug but which I was assured was my own bug.
If you cast a byte pointer to a short, you get the correct value in the
short except if the byte address happens to end in 7 or F, in which case
you get the int built out of two different bytes in the word.
This was a particulary hard bug (in my program?) to find since the casts
work well on non-RISC platforms (DOS and Ultrix) and DBX under OSF-1
treats them correctly.
DEC support, correctly, claims that C does not guarantee anything
reasonable will happen when casting (down/up?) from a byte pointer.
I found it unnerving, however, because that particular cast works well on
most boundaries, including odd ones, just fails on two particular
alignments. Also other casts, such as ints to shorts all seem to work as
expected.
Dennis
--
Amziod
40 Samuel Prescott Dr.
Stow, MA 01775 USA
Tel 508/897-7332, FAX 508/897-2784
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~1993-12-18 3:35 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1993-12-18 3:35 casting bug/feature? Merritt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox