Path: csiph.com!news.swapon.de!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Tim Rentsch
Newsgroups: comp.lang.c++
Subject: Re: Q: how to make an object that throws
Date: Thu, 25 Apr 2024 14:08:58 -0700
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <86bk5xw3o5.fsf@linuxsc.com>
References: <87wmoon5d3.fsf@fuzy.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Injection-Date: Thu, 25 Apr 2024 23:08:58 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="4d027413e75dd4b7b3c31e0f92925554"; logging-data="3382317"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/wFVGkzp8UpEVAwBb5Wlmj3hBevP5Ocqw="
User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.4 (gnu/linux)
Cancel-Lock: sha1:JtsWcNXrNAan6IwOh4dffdfrQH0= sha1:JD8Pe2FK43tEWTOy5gra84An8Ls=
Xref: csiph.com comp.lang.c++:118888
ram@zedat.fu-berlin.de (Stefan Ram) writes:
> Zhengyi Fu wrote or quoted:
>
>> int *object = NULL;
>
> This seems to be what's helping the OP, but when you consider
> that the subject line is "how to make an object that throws",
> you'd actually have to say that the thrower here is not an
> object, but rather the /absence of an object/.
>
> This of course has to do with how objects are specified.
>
> In C++, an expression can stand directly for an object, so
> an assignment copies that object. In other languages,
In some other languages. Certainly not all other languages.
> objects
> are always implicitly specified by references/pointers, and
> an assignment copies that reference/pointer.
Some languages that use pointer semantics rather than using
"objects" directly don't have a way to do assignment, so the
question of what is copied is moot.