Latest

Archive

Community news

C++

Communities and Content

Databases

Editorials

Emacs

General

HTML

Java

Notices

PHP

XML

Apache

C++

Database

General

HTML

Java

Javascript

Linux

Object oriented programming

Open source

Perl

PHP

Python

Ruby

SOAP

XML

Suggest a link

Advertise on zez

Contribute

Contact us

About zez


RE: C++ Styles


Categories C++ Code

Topic:

RE: C++ Styles

Author:

Gunnstein Lye

Time:

13.11.2000 11:01

Text:

Before you go writing yet another C++ coding style, have you looked at the others that are out there. Place to start is:
http://www.cs.umd.edu/users/cml/cstyle/

I have looked at it, and it is very complete and thorough. On the other hand, we already have a coding standard we are happy with, but we might consider using parts of this or other standards to expand our own. I will add it to the links section of zez.org, as it should be of great interest to many developers. Thanks!

In particular, read the Ellemtel style guide. With respect to your Part 1 & 2, here's some questions to consider:
* Any recommended directory structure to use in a large project?
* Any recommendations on filenames to improve sorting and searching?
* Should filenames use underscore or dash or nothing to separate words in the name?

These questions will be addressed in the next two issues of the article, if I recall correctly.

* Would you recommend macros for portability issues (ie. #ifdef for system types)?

We try to avoid this, but we do use it when it would be cumbersome not to.

* Should C++ keywords be surrounded by whitespace to prevent confusion with function names (ie. ease grepping)?

I prefer this. Generally speaking, I think whitespace is a good thing. It improves readability, and most people today have large enough screens to handle the extra length of the code.

* What do you think of this style for function definitions?
int // returning position in array
FindItem(
char* string // item to search for
) {
...
}

We use the Doxygen syntax to document our functions, and we prefer having curly brackets {} on separate lines and equal columns. However, having the function arguments on separate lines, enabling comments for each argument, seems a good idea. When using descriptive function and argument names these extra comments are rarely needed, so we currently don't use this.

* Have you looked at tools for literate programming like the following?
http://www.w3.org/Tools/Prog_lang_filters.html

Have not, will do.
regards, Gunnstein



Message threads

Topic: Author:
Time:
C++ Styles David Masterson 12.11.2000 03:44  
  RE: C++ Styles Gunnstein Lye 13.11.2000 11:01  


Forgot your password?

Register a new user

Results

Polls