Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6123337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T16:00:17+00:00 2026-05-23T16:00:17+00:00

I came across following piece of code in Boost Library for offset_ptr. under boost/interprocess/offset_ptr.hpp

  • 0

I came across following piece of code in Boost Library for offset_ptr. under boost/interprocess/offset_ptr.hpp

typedef PointedType *                     pointer;
...
    //!Constructor from other pointer.
    //!Never throws.
    template <class T>
    offset_ptr(T *ptr) 
    {  pointer p (ptr);  (void)p; this->set_offset(p); }

I wonder what does a statement (void)p; does?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T16:00:18+00:00Added an answer on May 23, 2026 at 4:00 pm

    One way to find out is to put a break point on that line of code and step through to find out what it does. You can even reformat the code to allow you to set the break point on that particular statement (there’s no law against editing these files – just don’t change the actual code).

    However, my guess is that the pointer type is using some form of lazy evaluation, the emulated cast operators call a set_offset method so maybe the this->set_offset(p) requires p to have a valid offset set up and doing the (void)p just forces it to happen.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I came across the following weird chunk of code.Imagine you have the following typedef:
I came across the following piece of code in the book on data structures
I came across a piece of assembly code like following one int fourth(char *str)
I'm going through someone else's code and came across the following syntax: typedef struct
I came across the following piece of code during a code review. My intuition
I came across the following expression in someone else's code. I think it's terrible
I came across the following regular expression below on one of my code, anyone
I came across the following code that compiles fine (using Visual Studio 2005): SomeObject
I came across the following code in a code base I am working on:
I have came across the following code, and being a C beginner, I came

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.