Hi Folks,
I'm wondering if there is a compilation of C++ guidelines out there
anywhere. Here are some of the ones I've picked up so far (as examples):
- Functions should fit on one screen, from various sources.
- Non-leaf classes should be abstract (have pure virtual methods), from
More Effective C++, Item 33.
- Virtual methods should be private by default and protected if they
need access to a base classes version (except for the destructor, of
course), from http://www.gotw.ca/publications/mill18.htm.
- Header files should be self contained, from various sources.
- Destructors for base classes should be either virtual or protected.
I think I've probably missed (or never heard of) quite a few more.
Anyone know where I can find such things? Or have some guidelines of
their own to share?
-- Pete
Jul 22 '05
64 3312
Claudio Puviani wrote:
[snip] http://search.barnesandnoble.com/boo...sbn=0521893089
It's basically an extension of what used to be Rogue Wave's guidelines. No one will agree with every guideline, but they're mostly reasonable.
Interesting.. but the summary says it deals with formatting, naming,
documentation, etc. I was looking for design guidelines along the lines
of those that I posted. Am I correct in assuming it doesn't cover such
issues? - Functions should fit on one screen, from various sources.
That's really a side-effect of a few more fundamental principles, such as "maximize cohesion" and "modularize where reasonable." A function that is very large should raise flags, but there are rare instances where it's entirely justified to have even extremely large functions (as anyone who's ever used YACC will testify).
Yes that example was more basic than I really wanted. Ignore it, I'm far
more interested in guidelines similar to the others that I posted. - Header files should be self contained, from various sources.
This one should be shredded or rephrased. Header files have dependencies just like any other software component, and so can rarely be self-contained.
[snip]
Obviously if a header file is from a library then the library must be
linked to. I meant from a compiler point of view.
More specifically that it should forward declare or #include everything
it requires to compile. I'm fairly sure most people would understand
this from "self contained", but I suppose I should have been more precise.
-- Pete
On Sat, 10 Apr 2004 16:16:23 +0100 in comp.lang.c++, Pete Vidler
<pv*****@mailbl ocks.com> wrote, This site may also be helpful: <http://www.chris-lott.org/resources/cstyle/>
Most of the links there appear to be documents detailing naming conventions and recommending a given style for the placement of braces. I'm looking for more along the lines of design guidelines like I posted
Well, arguing over the placement of braces has less potential for harm
than many of the design guidelines I have seen.
On Sat, 10 Apr 2004 16:16:23 +0100 in comp.lang.c++, Pete Vidler
<pv*****@mailbl ocks.com> wrote, This site may also be helpful: <http://www.chris-lott.org/resources/cstyle/>
Most of the links there appear to be documents detailing naming conventions and recommending a given style for the placement of braces. I'm looking for more along the lines of design guidelines like I posted
Well, arguing over the placement of braces has less potential for harm
than many of the design guidelines I have seen.
David Harmon wrote:
[snip] Well, arguing over the placement of braces has less potential for harm than many of the design guidelines I have seen.
Yes, but there's no potential for learning anything with
brace-placement. You can already see the possibilities.
-- Pete
David Harmon wrote:
[snip] Well, arguing over the placement of braces has less potential for harm than many of the design guidelines I have seen.
Yes, but there's no potential for learning anything with
brace-placement. You can already see the possibilities.
-- Pete
Pete Vidler <pv*****@mailbl ocks.com> wrote: Daniel T. wrote: [snip] Check out these two books: "Large-Scale C++ Software Design" by John Lakos
I've heard of this one, but isn't it seriously out of date? I've also heard that he has some strange guidelines like not using namespaces?
"Object-Oriented Design Heuristics" by Arthur J. Riel
I'll look into it, thanks.
This site may also be helpful: <http://www.chris-lott.org/resources/cstyle/>
Most of the links there appear to be documents detailing naming conventions and recommending a given style for the placement of braces. I'm looking for more along the lines of design guidelines like I posted (there was one good page there though, thanks).
I don't really need the basic stuff (I know most of them), but I am looking for more advanced guidelines (with justifications, like the one about making virtual methods private).
Try the articles at this site:
< http://tinyurl.com/2tt4h >
Pete Vidler <pv*****@mailbl ocks.com> wrote: Daniel T. wrote: [snip] Check out these two books: "Large-Scale C++ Software Design" by John Lakos
I've heard of this one, but isn't it seriously out of date? I've also heard that he has some strange guidelines like not using namespaces?
"Object-Oriented Design Heuristics" by Arthur J. Riel
I'll look into it, thanks.
This site may also be helpful: <http://www.chris-lott.org/resources/cstyle/>
Most of the links there appear to be documents detailing naming conventions and recommending a given style for the placement of braces. I'm looking for more along the lines of design guidelines like I posted (there was one good page there though, thanks).
I don't really need the basic stuff (I know most of them), but I am looking for more advanced guidelines (with justifications, like the one about making virtual methods private).
Try the articles at this site:
< http://tinyurl.com/2tt4h >
"Pete Vidler" <pv*****@mailbl ocks.com> wrote Claudio Puviani wrote: [snip] http://search.barnesandnoble.com/boo...sbn=0521893089 It's basically an extension of what used to be Rogue Wave's guidelines. No one will agree with every guideline, but they're mostly reasonable.
Interesting.. but the summary says it deals with formatting, naming, documentation, etc. I was looking for design guidelines along the lines of those that I posted. Am I correct in assuming it doesn't cover such issues?
It has rudimentary design guidelines as well. The formatting section is just
a few pages, and the least interesting at that.
Here's a list of books I posted once before that would give you what you
need:
For general inheritance guidelines, strategies, pitfalls, etc. (in no
particular order):
"C++ Primer" by Lippman and Lajoie
"Effective C++" by Scott Meyers
"More Effective C++" by Scott Meyers
"Effective STL" by Scott Meyers
"Exceptiona l C++" by Herb Sutter
"More Exceptional C++" by Herb Sutter
"Large Scale C++ Software Design" by John Lakos
"Designing and Coding Reusable C++" by Carroll and Ellis
"Rumination s on C++" by Koenig and Moo
"Enough Rope to Shoot Yourself in the Foot" by Allen Holub
"C++ Strategies and Tactics" by Bob Murray
"C++ Programming Style" by Tom Cargill
"C++ in Action" by Bartosz Milewski
"C++ Code Capsules" by Chuck Allison
and even the old but excellent "Advanced C++" by James Coplien
Claudio Puviani This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: beliavsky |
last post by:
Is there a more recent set of Python style guidelines than PEP 8,
"Style Guide for Python Code", by van Rossum and Warsaw, at
http://www.python.org/peps/pep-0008.html , which is dated July 5,
2001?
|
by: stevehayter |
last post by:
Wonder if anyone can help me solve this problem!
I have a 3x3 table which i'm using to create a table with a rounded
edge using images in the top left, top right, bottom left, and bottom
right cells and lines in the top/left/right and bottom cells (sounds
odd, you'll see what i mean when you see the site). It works fine,
except the top and...
|
by: Pete Vidler |
last post by:
Hi Folks,
I'm wondering if there is a compilation of C++ guidelines out there
anywhere. Here are some of the ones I've picked up so far (as examples):
- Functions should fit on one screen, from various sources.
- Non-leaf classes should be abstract (have pure virtual methods), from
More Effective C++, Item 33.
|
by: E. Robert Tisdale |
last post by:
C++ Programming Style Guidelines
http://geosoft.no/development/cppstyle.html
I think that these guidelines are almost *all* wrong.
For example:
11. Private class variables should have underscore suffix.
class SomeClass {
private:
|
by: jamilur_rahman |
last post by:
What is the BIG difference between checking the "if(expression)" in A
and B ? I'm used to with style A, "if(0==a)", but my peer reviewer
likes style B, how can I defend myself to stay with style A ?
style A:
....
....
int a = 1;
if(0==a)
{
| |
by: John Salerno |
last post by:
Does Microsoft have any naming guidelines for variables? I've been
reading their guidelines for just about every other type (methods,
parameters, properties, etc.) but nothing about variables. Are variables
treated the same as parameters (i.e., camel case)?
I notice that Hungarian notation is being done away with.
Also, is it good...
|
by: Laurent Bugnion [MVP] |
last post by:
Hi group,
In agreement with the head of our R&D department, I published my firm's
JavaScript Coding Guidelines. I work for Siemens Building Technologies.
We developed these guidelines for a web application project in 2004,
based on our C# guidelines.
http://www.galasoft-lb.ch/myjavascript/Siemens_SBT_JavaScript_Coding_Guidelines.pdf
...
|
by: mrashidsaleem |
last post by:
Can anyone guide me what is wrong with the naming conventions
suggested below? I know that this is not recommended by many
(including Microsoft) but I need to know what exactly is the rationale
behind going for a different convention in .NET. The recommendations
do make sense (to me, at least but I may be wrong and would like
someone to...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
| |
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |