Is move semantics in C++ something C is missing? -


i have been searching matter on , other sources couldn't wrap head around issue. using resouces of rvalues , xvalues new c++ (with c++11).

now, - c programmers - miss here? or there corresponding technique in c benefit these resource efficiency?

edit: quesiton not opinion based whatsoever. couldn't describe question. asking whether or not there corresponding technique in c.

of course, there similar technique in c. have been doing "move semantics" in c ages.

firstly, "move semantics" in c++ based on bunch of overload resolution rules describe how functions rvalue reference parameters behave during overload resolution. since c not support function overloading, specific matter not applicable c. can still implement move semantics in c manually, writing dedicated data-moving functions dedicated names , explicitly calling them when want move data instead of copying it. e.g, own data type struct heavystruct can write both copy_heavy_struct(dst, src) , move_heavy_struct(dst, src) functions appropriate implementations. you'll have manually choose appropriate/efficient 1 call in each case.

secondly, primary purpose of implicit move semantics in c++ serve alternative implicit deep-copy semantics in contexts deep copying unnecessarily inefficient. since c not have implicit deep-copy semantics, problem not arise in c. c performs shallow copying, pretty similar move semantics. basically, can think of c always-move language. needs bit of manual tweaking bring move semantics perfection.

of course, impossible literally reproduce features of c++ move semantics, since, example, impossible bind c pointer rvalue. virtually can "emulated". requires bit more work done explicitly/manually.


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -