home bbs files messages ]

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

   comp.os.linux.misc      Linux-specific topics not covered by oth      135,536 messages   

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

   Message 134,277 of 135,536   
   rbowman to Peter Flass   
   Re: naughty Python   
   03 Jan 26 00:52:51   
   
   XPost: alt.folklore.computers   
   From: bowman@montana.com   
      
   On Fri, 2 Jan 2026 15:00:07 -0700, Peter Flass wrote:   
      
   > On 1/2/26 14:33, Lawrence D’Oliveiro wrote:   
   >> On Fri, 2 Jan 2026 08:49:25 -0800, John Ames wrote:   
   >>   
   >>> ... it's not guaranteed that the compiler won't take liberties in   
   >>> arranging members of a struct for optimization purposes ...   
   >>   
   >> The C23 spec (section 6.2.5, “Types”) does say the member objects of a   
   >> struct type need to be “sequentially allocated”. The only freedom the   
   >> compiler has (section 6.2.6) is to add “padding bytes”.   
   >   
   > It defeats the purpose of a structure if the compiler is free to   
   > rearrange it. Local variables (PL/I AUTOMATIC) can, in most languages,   
   > be stored however the compiler wants.   
      
   That can lead to interesting bugs. The root cause is overflowing a local   
   variable, say writing 6 characters to a char[4]. Which adjacent local   
   variable gets whacked depends on the compiler's ordering. Whether it   
   manifests as a bug depends on how the corrupt variable is used in the   
   function and where it is initialized.   
      
   --- 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