title: offsetof() of nested C struct in C++
body: <p>I'm trying to add a socket filter to one of my sockets in C++ (Linux). In the socket filter I need to get the offset of <em>struct fork_proc_event</em>, which is nested within another structure. The definition looks like this (cn_proc.h):</p>
  
  <pre>struct proc_event {
      ...
      union {
          ...
          struct fork_proc_event {
              __kernel_pid_t parent_pid;
              ...
          } fork;
          ...
      } event_data;
      ...
  };</pre>
  
  <p>In C I would do this:</p>
  
  <p><code>int off = offsetof(struct fork_proc_event, parent_pid);</code></p>
  
  <p>However I'm developing in C++. If I try to do this:</p>
  
  <p><code>int off = offsetof(proc_event::fork_proc_event, parent_pid);</code></p>
  
  <p>I get the following error:</p>
  
  <pre>error: expected type-specifier
  error: expected `,'
  error: expected `)' before ',' token</pre>
  
  <p>How should the offsetof() line look like?</p>