Slashdot is powered by your submissions, so send in your scoop


Forgot your password?
Last Chance - Get 15% off sitewide on Slashdot Deals with coupon code "BLACKFRIDAY" (some exclusions apply)". ×

Submission + - How to make C/C++ compilers generate terrible code ( 1

An anonymous reader writes: Compilers are designed to make pessimistic assumptions about the code if the code is ambiguous. These pessimistic assumptions significantly limit the compilers' optimizations. Programmers can help compilers by avoiding code patterns that are known to confuse them. This article presents three examples of compiler-unfriendly code and explains them in great depth. I found this post enlightening and novel since I haven't seen a post on this topic. Its a good read if you want to understand what a compiler does to your code.
This discussion was created for logged-in users only, but now has been archived. No new comments can be posted.

How to make C/C++ compilers generate terrible code

Comments Filter:
  • Nice article. I knew some of it already but had not thought of the function calls across multiple files. My problem is however is that why people use C/C++ at all. I understand that C/C++ programmers need to jump through a lot of hoops to get the compiler to understand the big picture. This is why I prefer JAVA because their is no ambiguous code. The compiler knows everything and every dependency.

Some programming languages manage to absorb change, but withstand progress. -- Epigrams in Programming, ACM SIGPLAN Sept. 1982