Hello, I don't have anything to add to the threads topic itself, but was triggered by something:
On Tue, 26 Nov 2024, Jonathan Wakely wrote: > > > const size_t __bufsz = __deque_buf_size(sizeof(_Tp)); > > ... > > I wonder why "const" is useful here. > > Because if you don't initialize a constant expression, then you get a > runtime call to __deque_buf_size instead, which then has to be > inlined. Hmm? Are you saying there's a difference in inlining (or other) behaviour between the two initializer lines in foo: extern int bla(void); int foo (void) { const int x = bla(); int y = bla(); return x + y; } That would be surprising. Would it change if 'bla' was not a extern function but something marked specially, constexpr or member function or similar? But that would also be surprising to me. I.e. ... > Using the call to initialize a const size_t ensures it's a constant > expression, and there's nothing for the inliner to do. ... why would a cv qualifier on the non-reference LHS of an initialization put any constraints on the kind of expressions on the RHS? Ciao, Michael.