home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c      Meh, in C you gotta define EVERYTHING      243,242 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 241,282 of 243,242   
   Kaz Kylheku to Keith Thompson   
   Re: Nice way of allocating flexible stru   
   09 Oct 25 01:39:36   
   
   From: 643-408-1753@kylheku.com   
      
   On 2025-10-08, Keith Thompson  wrote:   
   > But in addition to that, in Kaz's example, n is not a constant   
   > expression, so `&(t.member-designator)` is not an address constant   
   > and therefore `offsetof(S, A[n])` has undefined behavior.   
      
   Great; I'd like to hear reasons to avoid it so I don't look foolish   
   for having overlooked it for manytyears. :)   
      
   > Every compiler I've tried handles this "correctly", and I tend to   
      
   I'm sure I've seen foo.bar expressions on the right of an offsetof,   
   but those still yield constants.   
      
   --   
   TXR Programming Language: http://nongnu.org/txr   
   Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal   
   Mastodon: @Kazinator@mstdn.ca   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca