[Box Backup-dev] Merges

Ben Summers boxbackup-dev@fluffy.co.uk
Sun, 20 Aug 2006 09:26:26 +0100


On 20 Aug 2006, at 01:47, Chris Wilson wrote:

>
>> 1. I'm guessing Ben might have something to say about the naming  
>> of the
>> new struct.
>>
>> 2. This adds new options 'T' to list and 'A' to compare, but no  
>> code to
>> handle them.
>
> Well spotted, thanks! Fixed in r799. I'll wait for Ben to tell me  
> what he wants the struct to be called before asking you to review  
> again.


Well cmd_info_t is not exactly in the project coding style.  
QueryCommandSpecification might fit in better and describe what it is  
more accurately.

I hope everyone else thinks coding standards are important.

I read a essay recently which suggested that the compilers should  
enforce coding standards. I think that's a good plan. It's not that  
any coding standard is correct or better or The One True Way, it's  
just that it's important for everyone on a project to use the same one.



>
>>> Please consider 766:767 for merge.
>>
>> 1. What if rDir to MakeFullPath is empty? If that's impossible it  
>> should
>> be documented as a precondition.
>>
>> 2. Why are you changing copy construction of locals to assignment?  
>> Copy
>> construction is better.
>
> Fixed both. Please review for merge:
>
>   svn diff -r 766:800 \
>   http://bbdev.fluffy.co.uk/svn/box/chris/general/bin/bbackupd/ 
> BackupClientDirectoryRecord.cpp
>
> By the way, why is copy construction better? More efficient?

Less function calls.

  std::string pants(FunctionReturningString());

works by copying the result of the function into the local variable  
using the copy constructor.

  std::string pants = FunctionReturningString();

works by copying the result of the function into a 'hidden' local  
variable, constructing the local variable, assigning the hidden  
variable to the local variable, then deleting the hidden variable. It  
cannot be optimised to the first case, because the compiler must call  
operator= on the local variable to avoid funny things happening if  
you define your operators in odd ways. (Trivial example: imagine you  
have a member variable which records how the object was constructed.)

At least I think that's it. C++ is unnecessarily complex. I find it  
an effective language to work in, but it has taken me quite a while  
to learn it. But what else is low level enough to be able to write  
system code, high level enough to be able to abstract concepts and do  
OO stuff, and portable enough to compile and run anywhere?

Ben