C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Callsite passed as template parameter

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Thu, 16 Nov 2023 09:38:11 +0000
On Wed, Nov 15, 2023 at 11:40 PM Thiago Macieira via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> On Wednesday, 15 November 2023 15:30:31 PST Jason McKesson via Std-Proposals
> wrote:
> > I see nothing about this that would be "cool". You're increasing the
> > static size requirements of your entire binary every time you do it.
> > Memory that will likely go unused for 99% of your application's
> > runtime.
>
> It's also read-write memory, at least in the way the code was written.


Not sure what you mean by 'read-write memory' here. The
null-terminated string isn't going to be stored in ROM or Flash if the
string_view isn't known until runtime.

And as regards memory going unused for 99% of the application's
runtime, I favour this in two scenarios:
(1) When programming a microcontroller, I keep heap allocation to an
absolute bare minimum -- I don't want future allocations to fail
because of a fragmented heap.
(2) Extreme micro-optimisation -- although I very very rarely favour a
micro-optimisation over good coding practise.

Received on 2023-11-16 09:38:24