[Tarantool-patches] [PATCH 1/2] alter: use good c++ style

Timur Safin tsafin at tarantool.org
Tue Jul 14 00:51:11 MSK 2020


: From: Aleksandr Lyapunov
: Subject: [Tarantool-patches] [PATCH 1/2] alter: use good c++ style
: 


: @@ -1392,14 +1388,14 @@ ModifyIndex::alter(struct alter_space *alter)
:  }
: 
:  void
: -ModifyIndex::commit(struct alter_space *alter, int64_t signature)
: +ModifyIndex::commit(struct alter_space *alter, int64_t signature)
: noexcept
:  {
:  	(void)alter;

This is C++, not C - we could simply omit argument name, and there is 
no need to dereference argument to make compiler shut

: @@ -1475,7 +1471,7 @@ CreateIndex::prepare(struct alter_space *alter)
:  }
: 
:  void
: -CreateIndex::commit(struct alter_space *alter, int64_t signature)
: +CreateIndex::commit(struct alter_space *alter, int64_t signature)
: noexcept
:  {
:  	(void) alter;

The same comment is applicable here - we could simply omit argument name


: @@ -1627,7 +1624,7 @@ TruncateIndex::prepare(struct alter_space *alter)
:  }
: 
:  void
: -TruncateIndex::commit(struct alter_space *alter, int64_t signature)
: +TruncateIndex::commit(struct alter_space *alter, int64_t signature)
: noexcept
:  {
:  	(void)alter;

And here... 

:  	index_commit_drop(old_index, signature);
: @@ -1652,14 +1649,14 @@ class UpdateSchemaVersion: public AlterSpaceOp
:  public:
:  	UpdateSchemaVersion(struct alter_space * alter)
:  		:AlterSpaceOp(alter) {}
: -	virtual void alter(struct alter_space *alter);
: +	void alter(struct alter_space *alter) noexcept override;
:  };
: 
:  void
: -UpdateSchemaVersion::alter(struct alter_space *alter)
: +UpdateSchemaVersion::alter(struct alter_space *alter) noexcept
:  {
: -    (void)alter;

And here ...

: -    ++schema_version;
: +	(void) alter;
: +	++schema_version;

But here we could ask _very important question_ (:)) do we use spaces
or tabs (like in C) for indenting C++ sources? Looks like Tabs are not yet
used in this file, thus no need to enforce the different style.


:  }
: 
:  /**
: @@ -1853,14 +1851,15 @@ CreateConstraintID::alter(struct alter_space
: *alter)
:  }
: 
:  void
: -CreateConstraintID::rollback(struct alter_space *alter)
: +CreateConstraintID::rollback(struct alter_space *alter) noexcept
:  {
:  	space_delete_constraint_id(alter->new_space, new_id->name);
:  	new_id = NULL;
:  }
: 
:  void
: -CreateConstraintID::commit(struct alter_space *alter, int64_t signature)
: +CreateConstraintID::commit(struct alter_space *alter,
: +                           int64_t signature) noexcept
:  {
:  	(void) alter;
:  	(void) signature;

Here we could omit names of both arguments ...

: -DropConstraintID::alter(struct alter_space *alter)
: +DropConstraintID::alter(struct alter_space *alter) noexcept
:  {
:  	old_id = space_pop_constraint_id(alter->old_space, name);
:  }
: 
:  void
: -DropConstraintID::commit(struct alter_space *alter, int64_t signature)
: +DropConstraintID::commit(struct alter_space *alter, int64_t signature)
: noexcept
:  {
:  	(void) alter;
:  	(void) signature;

The same comment is applicable here also...

Best Regards,
Timur



More information about the Tarantool-patches mailing list