Re: AMD opteron 64
From: Keith Thompson (kst-u_at_mib.org)
Date: 12/02/03
- Next message: Eric Sosman: "Re: gets() rationale"
- Previous message: Sidney Cadot: "Re: Is C99 the final C? (some suggestions)"
- In reply to: glen herrmannsfeldt: "Re: AMD opteron 64"
- Next in thread: Chris Torek: "Re: AMD opteron 64"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 02 Dec 2003 22:01:24 GMT
glen herrmannsfeldt <gah@ugcs.caltech.edu> writes:
> E. Robert Tisdale wrote:
> > Barry Schwarz wrote:
> >> On a machine where the method of returning a pointer
> >> differs from the method of returning an int
> >> (such as using a different register),
> > Please tell us which machine does this.
>
> Any machine where sizeof(int) is different than sizeof(char*) will do.
>
> Though this is more OS or function calling convention dependent than
> machine dependent.
Note that this (calling malloc() with no prototype) may happen to work
on some systems even if sizeof(int) > sizeof(void*). For example, if
int is 32 bits, void* is 64 bits, the value returned by malloc happens
to have the 32 high-order bits all zero, the machine is little-endian
(I think), and a few other unstated assumptions hold, you could
accidentally extract a valid 64-bit pointer from what the compiler
thinks is a 32-bit int result.
This is, of course, deep in the realm of undefined behavior. "Happens
to work" is actually a bad thing, because it can make it more
difficult to detect bugs. (Hey, maybe we should start referring to
this kind of thing as "HTW". 8-)})
-- Keith Thompson (The_Other_Keith) kst-u@mib.org <http://www.ghoti.net/~kst> San Diego Supercomputer Center <*> <http://www.sdsc.edu/~kst> Schroedinger does Shakespeare: "To be *and* not to be" (Note new e-mail address)
- Next message: Eric Sosman: "Re: gets() rationale"
- Previous message: Sidney Cadot: "Re: Is C99 the final C? (some suggestions)"
- In reply to: glen herrmannsfeldt: "Re: AMD opteron 64"
- Next in thread: Chris Torek: "Re: AMD opteron 64"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|