C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Should copying of the same type or its subtype be prohibited before constructing an object?

From: David wang <wangjufan_at_[hidden]>
Date: Mon, 13 May 2024 22:57:09 +0800
On Mon, 13 May 2024 10:39:01 -0400 Arthur O'Dwyer via Std-Proposals <
std-proposals_at_[hidden]> wrote:

>That's just an infinite recursion. Like this:
> int f(int x) {
> return f(x-1);
> }
>Sure, *sometimes* you write an infinite recursion by accident. But that's
>no reason to ban *all* recursion from the language. Just don't do that,
>then.

It is different from this. f(int x) requires x to be constructed before it
is called. During f(x-1)'s calling, the call of f(int x) is in progress. I
have no intention of disabling recursion in the language.

Received on 2024-05-13 14:57:23