Re: ELF2.0: Linkable struct

2025-01-31 Thread Jonathan Wakely via Gcc
On Fri, 31 Jan 2025 at 18:56, Ian Lance Taylor via Gcc wrote: > > On Fri, Jan 31, 2025 at 7:37 AM The Cuthour via Gcc wrote: > > > > I understand the concerns about the C++ standard requiring constant > > expressions to be known during compilation. However, my proposal for > > link-time evaluatio

Re: ELF2.0: Linkable struct

2025-01-31 Thread Ian Lance Taylor via Gcc
On Fri, Jan 31, 2025 at 7:37 AM The Cuthour via Gcc wrote: > > I understand the concerns about the C++ standard requiring constant > expressions to be known during compilation. However, my proposal for > link-time evaluation offers significant flexibility and efficiency > improvements that could a

Re: ELF2.0: Linkable struct

2025-01-31 Thread The Cuthour via Gcc
Hi C++ requires constant expressions to be known during compilation, not at link time. A constant that is not determined at compile-time is akin to constructor that is const but not constexpr. While it remains constant throughout the program, its value is established only at link-time, not a

Re: ELF2.0: Linkable struct

2025-01-31 Thread Jakub Jelinek via Gcc
On Fri, Jan 31, 2025 at 11:24:33PM +0900, The Cuthour via Gcc wrote: > > C++ requires constant expressions to be known during compilation, not > > at link time. > > A constant that is not determined at compile-time is akin to > constructor that is const but not constexpr. While it remains > consta

Re: ELF2.0: Linkable struct

2025-01-31 Thread The Cuthour via Gcc
Hi On 2025/01/31 18:47, Jonathan Wakely wrote: On Fri, 31 Jan 2025 at 08:28, The Cuthour wrote: On 2025/01/31 17:05, Jonathan Wakely wrote: On Fri, 31 Jan 2025, 06:50 The Cuthour via Gcc, mailto:gcc@gcc.gnu.org>> wrote: Suppose we have the following two classes: === Vec.h ==

Re: ELF2.0: Linkable struct

2025-01-31 Thread Jonathan Wakely via Gcc
On Fri, 31 Jan 2025 at 08:28, The Cuthour wrote: > > > > On 2025/01/31 17:05, Jonathan Wakely wrote: > > > > > > On Fri, 31 Jan 2025, 06:50 The Cuthour via Gcc, > > wrote: > > > > > > Suppose we have the following two classes: > > > > === Vec.h === > > class Ve

Re: ELF2.0: Linkable struct

2025-01-31 Thread The Cuthour via Gcc
On 2025/01/31 17:05, Jonathan Wakely wrote: On Fri, 31 Jan 2025, 06:50 The Cuthour via Gcc, > wrote: Suppose we have the following two classes: === Vec.h === class Vec {      int x, y, z; }; === end Vec.h === === Pix.h === class P

Re: ELF2.0: Linkable struct

2025-01-31 Thread Jonathan Wakely via Gcc
On Fri, 31 Jan 2025, 06:50 The Cuthour via Gcc, wrote: > > Suppose we have the following two classes: > > === Vec.h === > class Vec { > int x, y, z; > }; > === end Vec.h === > > === Pix.h === > class Pix: Vec { > int r, g, b; > }; > === end Pix.h === > > If we add or remove a member var

Re: ELF2.0: Linkable struct

2025-01-30 Thread The Cuthour via Gcc
Hi struct image { vec2 pos[2]; std::vector pixels; }; Now if any of those structs are modified, members added or removed, it would require recompilation of the whole code that uses it. This is because the memory offsets to access the fields change and might fall out of the displacement r

Re: ELF2.0: Linkable struct

2025-01-30 Thread Oleg Endo via Gcc
On Fri, 2025-01-31 at 15:49 +0900, The Cuthour via Gcc wrote: > Suppose we have the following two classes: > > === Vec.h === > class Vec { > int x, y, z; > }; > === end Vec.h === > > === Pix.h === > class Pix: Vec { > int r, g, b; > }; > === end Pix.h === > > If we add or remove a memb

ELF2.0: Linkable struct

2025-01-30 Thread The Cuthour via Gcc
Suppose we have the following two classes: === Vec.h === class Vec { int x, y, z; }; === end Vec.h === === Pix.h === class Pix: Vec { int r, g, b; }; === end Pix.h === If we add or remove a member variable in class Vec, it requires recompiling not only Vec.cc but also Pix.cc. I believ