Liste des Groupes | Revenir à cl c |
On 28/08/2024 11:55, Bonita Montero wrote:All C++-compilers today can handle this.Am 28.08.2024 um 15:52 schrieb Thiago Adams:If you put everything on compiler bill, then you don't need move etc..
>You have to deallocate only if the ownership still with the>
same object. This is not the case when the object is moved.
Take this code
>
string str;
>
int main ()
{
string str( "hello" );
::str = move( str );
}
>
With clang-cl (the MSVC-flavour of clang) the whole string-creation
and destruction is opmized away and the compiler directly checks if
::str contains any externally allocated and if not it makes a short
-string-optimized "copy" to ::str. That's nine instructions for the
whole string copy with clang-cl 17.0.3; no external call.
>
>
This create a language that is hard to trust.
Les messages affichés proviennent d'usenet.