[ruby-cvs:68743] shyouhei:r61560 (trunk): offsetof(type, foo.bar) is (arguably) a GCCism

shyouhei at ruby-lang.org shyouhei at ruby-lang.org
Tue Jan 2 15:41:57 JST 2018


shyouhei	2018-01-02 15:41:56 +0900 (Tue, 02 Jan 2018)

  New Revision: 61560

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=61560

  Log:
    offsetof(type, foo.bar) is (arguably) a GCCism
    
    TL;DR see http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2031.htm
    
    Suppose we have:
    
    struct X {
      struct Y {
        z_t z;
      } y;
    } x;
    
    then, you _cant_ infer offsetof(struct X, y.z). The ISO C99 section
    7.17 says nothing about such situation. At least clang warns this
    being an extension to the language (-Wextended-offsetof).

  Modified files:
    trunk/thread_pthread.c
    trunk/variable.c


More information about the ruby-cvs mailing list