Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

98
Views
Does copy elision exist in C?

As I read about copy elision, many of the sources only mention C++ and not C.

They state how the C++ standard allows this optimization to take place if the compiler decides it is the right thing to do.

But what about C? Do C compilers perform copy elision, or does the C standard gaurentee that copies will never be optimized away?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Both C and C++ allow any optimizations that follow the as-if rule. Since C doesn't have constructors - and therefore constructors with side-effects- copies may be elided without breaking this rule. C++ on the other hand needs to make a special case where an implementation is allowed to break as-if.

So, copy elision exists in C implicitly through the as-if rule.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!