[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-devel] pointer arithmetics in C++
From: |
Markus Schiltknecht |
Subject: |
[Monotone-devel] pointer arithmetics in C++ |
Date: |
Fri, 15 Sep 2006 22:17:05 +0200 |
User-agent: |
Thunderbird 1.5.0.5 (X11/20060812) |
Hi,
I know, I know, it's evil. I want to do some pointer arithmetics
anyway... I need to build a hash or digest or something from three
'unsigned int' values and a pointer.
The simplest thing I came up with is XORing all four values. But I've
had a hard time convincing the compiler to do what I wanted...
I came up with that (simplified):
int
get_digest(int foo, shared_ptr<struct bar> baz)
{
return foo | *reinterpret_cast<int*>(b.get())
}
Is reinterpret_cast right here? What does that mean? Where can I find
documentation about all the different _cast methods? Should I use a
by-reference argument, i.e.:
int
get_digest(int foo, shared_ptr<struct bar> & const baz)
....
Help greatly appreciated.
Regards
Markus
- [Monotone-devel] pointer arithmetics in C++,
Markus Schiltknecht <=