×

Welcome to the Slashdot Beta site -- learn more here. Use the link in the footer or click here to return to the Classic version of Slashdot.

Thank you!

Before you choose to head back to the Classic look of the site, we'd appreciate it if you share your thoughts on the Beta; your feedback is what drives our ongoing development.

Beta is different and we value you taking the time to try it out. Please take a look at the changes we've made in Beta and  learn more about it. Thanks for reading, and for making the site better!

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

Anonymous Coward writes | more than 2 years ago

Software 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."
Link to Original Source

1 comment

C/C++? (1)

AustinAlert (2203328) | more than 2 years ago | (#36317400)

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.
Check for New Comments
Slashdot Account

Need an Account?

Forgot your password?

Don't worry, we never post anything without your permission.

Submission Text Formatting Tips

We support a small subset of HTML, namely these tags:

  • b
  • i
  • p
  • br
  • a
  • ol
  • ul
  • li
  • dl
  • dt
  • dd
  • em
  • strong
  • tt
  • blockquote
  • div
  • quote
  • ecode

"ecode" can be used for code snippets, for example:

<ecode>    while(1) { do_something(); } </ecode>
Sign up for Slashdot Newsletters
Create a Slashdot Account

Loading...