Date: Sun, 12 Jan 2025 21:05:47 +0000
On Sat, Jan 11, 2025 at 11:18 PM Ehsan Amiri <ehsan.amiri_at_[hidden]> wrote:
>
> Yes, I have something like your example in mind.
How intelligent do you want the compiler to be? I mean if it encounters:
void emplace_back(T const &) [[container_add, might_realloc]]
{
. . .
}
then should it use the remote API to access ChatGPT to ask it what way
the assembler should be written for a (stereotypical) method that adds
to a container and might reallocate?
I'm just thinking here that you're expecting a lot from the compiler.
And that it will all be based on stereotypes (or at least based on
most common practise).
Fair enough if you keep it to simple ideas, such as marking a method
as "never allocates memory", "rarely allocates memory" or "frequently
allocates memory", but the list of possibilities is endless -- I mean
you could mark a method as adding an item to a sorted priority queue
which might reallocate memory and which rarely spawns a second thread.
How about you give us an example of a class with a few methods,
something that you would actually use in real life?
>
> Yes, I have something like your example in mind.
How intelligent do you want the compiler to be? I mean if it encounters:
void emplace_back(T const &) [[container_add, might_realloc]]
{
. . .
}
then should it use the remote API to access ChatGPT to ask it what way
the assembler should be written for a (stereotypical) method that adds
to a container and might reallocate?
I'm just thinking here that you're expecting a lot from the compiler.
And that it will all be based on stereotypes (or at least based on
most common practise).
Fair enough if you keep it to simple ideas, such as marking a method
as "never allocates memory", "rarely allocates memory" or "frequently
allocates memory", but the list of possibilities is endless -- I mean
you could mark a method as adding an item to a sorted priority queue
which might reallocate memory and which rarely spawns a second thread.
How about you give us an example of a class with a few methods,
something that you would actually use in real life?
Received on 2025-01-12 21:05:48