[Box Backup] Coding standards

Ben Summers boxbackup@fluffy.co.uk
Wed, 31 Aug 2005 11:43:57 +0100


On 31 Aug 2005, at 11:24, Martin Ebourne wrote:

> Ben Summers <ben@fluffy.co.uk> wrote:
>
>> So, are they OK?
>>
>
> Looks ok to me, just a couple of points below.
>
>
>> Non-member function calls are prefixed with ::, eg ::printf(...).
>>
>
> The scoping operator should be used where correct and appropriate.

The intention for this is to clearly show non-class functions, and to  
reduce ambiguity.

>
> eg.
> printf is in <cstdio> and is part of the std namespace, so it  
> should be std::printf.
> execve is in <unistd.h> and is not in a namespace, so it should  
> be ::execve.
>
> I think it is often useful to put 'using namespace std;' in .cpp  
> files (but never in .h files), to make the code more readable.

Ah, there we differ. I always use explicit std:: namespacing.

>
>
>> Use the STL wherever useful, but don't use the STL style!
>>
>
> How do you define 'STL style'?

Lower case with underscore separators, eg const_iterator not  
ConstIterator.

Ben