Boost logo

Boost Users :

Subject: Re: [Boost-users] [interprocess] access dynamically accessed shared region in another process
From: Stephan Menzel (stephan.menzel_at_[hidden])
Date: 2009-04-01 16:00:43


Am Mittwoch, 1. April 2009 21:13:33 schrieb Ion Gaztañaga:
> > // Check alignment
> > assert((static_cast<void *>(ret->buf) - static_cast<void *>(0)) %
> > Alignment == 0);
>
> Obviously, offset_ptr is not a pointer so it can be static_cast'ed.
> offset_ptr is a smart pointer that emulates a pointer that can be placed
> in shared memory. See offset_ptr docs and implementation for more
> details. Try
>
> // Check alignment
> assert((static_cast<void *>(ret->buf.get()) - static_cast<void *>(0)) %
> Alignment == 0);

Indeed. That was what I tried first. But that doesn't work either:
The compiler says "invalid use of »void«"
However, this does:

assert((static_cast<char *>(ret->buf.get()) - static_cast<char *>(0)) %
 Alignment == 0);

The pointer arithmetics need char*.

So everything is fine. Thanks a bunch for your help with that great library!

Cheers,

Stephan


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net