1// Copyright (c) 2012 Google Inc. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#define offsetof(st, m) ((unsigned)((char*)&((st*)0)->m - (char*)0)) 6 7struct MyStruct { 8 virtual void MyFunc() = 0; 9 int my_member; 10}; 11 12int main() { 13 unsigned x = offsetof(MyStruct, my_member); 14 return x ? 0 : 1; 15} 16