Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It greatly depends on your project. The general advice seems to be: Don't bother having a concrete standard for C++.</p> <p>E.g. with typedefs there are multiple opinions both "for" and "against".</p> <p>The reason why a concrete coding style for C++ is less important in C++ is because the language does not provide the ways to enforce and check those styles. I.e. the grammar isn't easily parsable and therefore there are pretty much no tools to meaningfully style-check / refactor C++ code. Which means that the weight of the style-check falls on the programmer's shoulders. I.e. it makes less sense to enfore style guides, because then much of the time saved by them is wasted in manual style checks.</p> <p>So just use whatever your project / company uses or decides to use.</p> <p>Here are my personal preferences:</p> <p><strong>Allocators:</strong> No opinion. If you need a custom allocator, chances are you'll know better than me what to do with it.<br> <strong>Interfaces:</strong> If you're doing any performance-sensitive work - don't. They make things noticeably slower in a realtime application. Both abstract virtual classes and the pImpl pattern.<br> <strong>Templates instead of abstract base classes:</strong> It depends. But the general opinion seems to be that templates should be used for container-like functionality and a few other simple cases. Otherwise, it's a decent pattern. Debugging these is still a serious pain and will be in the next few years.<br> <strong>Restricting exception throwing:</strong> Yeah, do that. Try not to use exceptions, because believe it or not, in 2012 they are still not universally supported.<br> <strong>Using typedefs:</strong>: Just try to use c++11's std::auto. Otherwise, they kind of make your life harder because they're halfway to #define macros. I'd personally use an IDE (or Vim) to ease the typing stress of longs names and write the long names.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload