[Eug-lug] LP64
T. Joseph CARTER
knghtbrd at bluecherry.net
Sun Jan 9 04:07:26 PST 2005
On Sun, Jan 09, 2005 at 12:35:36AM -0800, Jacob Meuser wrote:
> > OK, that's officially weird.
> >
> > The correct way to fix that code is probably like this:
> >
> > int data;
> > ...
> > data = open(...);
>
> yes.
I'll agree with Neil above.
> > I can think of no sensible reason to cast it to
> > a pointer--it will never point to anything useful, and deferencing it will
> > probably earn you an immediate trip to the land of segmentation violation.
> >
> > And on an LP64 compiler, casting to a pointer is just plain wrong--ints and
> > pointers aren't the same size anymore, and you don't want to shut gcc up,
> > because it's trying to tell you something important.
>
> the thing is, there's also a foo_open function, that returns a
> pointer to a struct. the code was apparently written to make
> open and ibp_open interchangable. since they have different
> return types, the author chose to use (void *). the only use
> of data is "if(!data) { ... }".
Suggest fixing ibp_open? (what's it do?)
More information about the EUGLUG
mailing list