Thread: sizeof operator, im confused

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    SnoopFrogg KingFlippyNips's Avatar
    Join Date
    Sep 2016
    Posts
    33
    What does this do?
    Code:
     offsetof();

  2. #2
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Quote Originally Posted by KingFlippyNips View Post
    What does this do?
    Code:
     offsetof();
    offsetof - cppreference.com
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  3. #3
    Registered User
    Join Date
    Apr 2017
    Posts
    80
    Quote Originally Posted by KingFlippyNips View Post
    What does this do?
    Code:
     offsetof();
    That's C++ not C though.

    Just thought I'd point that out as I thought "I've never seen that before", and now I know why (I don't know C++).

  4. #4
    Lurking whiteflags's Avatar
    Join Date
    Apr 2006
    Location
    United States
    Posts
    9,612
    Quote Originally Posted by BpB View Post
    That's C++ not C though.

    Just thought I'd point that out as I thought "I've never seen that before", and now I know why (I don't know C++).
    I want to point out that this is still C. The person you are replying to simply used a C++ reference site.

    offsetof(3): offset of structure member - Linux man page

    On the above linked page you will also see, among other information, what standards this conforms to: C89, C99, POSIX.

    The reason you might not have encountered it would be it's not considered a beginner tool, i.e. it's reasonable you will write entire programs without it. I'm sure it's most common use is in the debugging area.

  5. #5
    Registered User
    Join Date
    Apr 2017
    Posts
    80
    Quote Originally Posted by whiteflags View Post
    I want to point out that this is still C. The person you are replying to simply used a C++ reference site.

    offsetof(3): offset of structure member - Linux man page

    On the above linked page you will also see, among other information, what standards this conforms to: C89, C99, POSIX.

    The reason you might not have encountered it would be it's not considered a beginner tool, i.e. it's reasonable you will write entire programs without it. I'm sure it's most common use is in the debugging area.
    I see, right, thanks for that correction.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. sizeof operator in c
    By Saurabh Mehta in forum C Programming
    Replies: 10
    Last Post: 01-27-2013, 08:48 PM
  2. sizeof operator
    By saswatdash83 in forum C Programming
    Replies: 2
    Last Post: 07-26-2010, 12:38 AM
  3. Replies: 6
    Last Post: 10-15-2007, 08:05 AM
  4. sizeof operator
    By Dave Jay in forum C Programming
    Replies: 9
    Last Post: 04-05-2005, 10:14 PM
  5. sizeof operator
    By Roaring_Tiger in forum C Programming
    Replies: 9
    Last Post: 09-05-2004, 07:31 AM

Tags for this Thread