[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#325357: vrweb: FTBFS on 64 bit arches: cast from 'AnyLight*' to 'int' loses precision

On Sun, Aug 28, 2005 at 10:39:25AM +0200, Petter Reinholdtsen wrote:
> [Kurt Roeckx]
> > It's trying to print the address.  In C, with printf, you'd use a %p
> > for it.  I have no idea if std::cout has something simular.
> Is this the only place this is happening?  Did it compile when this
> line is fixed?  Is this the only 64-bit problem in this code?

It compiled after that line was fixed, I did not try to run it.
It seems to be working.

> > I think the easiest way to fix it would be cast it to an intptr_t.
> The code in question is debug output.  I guess it is trying to print
> out a pointer, yes.  Why not just drop the cast completely?
>    FaceAttr* faceattr = new FaceAttr(vertex_num, vertexlist_wc,
>                                      0 /*normal_num*/, normallist_wc);
>    [...]
>    std::cout << "addr of light_: " << faceattr->light() << std::endl;
>  * std::cout << int (*(faceattr->light())) << std::endl;
>    faceattr->print();
> faceattr->light() returns 'AnyLight**', and thus this line try to
> print 'AnyLight*'.  If it can porint 'AnyLight**', it should be
> capable of printing 'AnyLight*' too.

You're right, just dropping the cast makes it build too.


Reply to: