]> git.sesse.net Git - stockfish/commitdiff
Clean functions returning by const values
authorAntoine Champion <antoine.champion@outlook.com>
Sat, 30 Jan 2021 08:50:04 +0000 (09:50 +0100)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Sun, 7 Mar 2021 13:05:01 +0000 (14:05 +0100)
The codebase contains multiple functions returning by const-value.
This patch is a small cleanup making those function returns
by value instead, removing the const specifier.

closes https://github.com/official-stockfish/Stockfish/pull/3328

No functional change

AUTHORS
src/bitboard.cpp
src/bitboard.h
src/misc.cpp
src/misc.h
src/position.cpp
src/position.h

diff --git a/AUTHORS b/AUTHORS
index 5f21c0485b30db09e7635a8e1ac2d52dbcb9c828..3ef7d1b13ecba5e09da82f5868e2a7c96a99ef88 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -24,6 +24,7 @@ Ali AlZhrani (Cooffe)
 Andrew Grant (AndyGrant)
 Andrey Neporada (nepal)
 Andy Duplain
+Antoine Champion (antoinechampion)
 Aram Tumanian (atumanian)
 Arjun Temurnikar
 Auguste Pop
index 841aa0b6c1f06c8dc5886a49d213417de8f47d50..8146ce9722843eafc7ff9370cf161f96edeb933b 100644 (file)
@@ -55,7 +55,7 @@ inline Bitboard safe_destination(Square s, int step) {
 /// Bitboards::pretty() returns an ASCII representation of a bitboard suitable
 /// to be printed to standard output. Useful for debugging.
 
-const std::string Bitboards::pretty(Bitboard b) {
+std::string Bitboards::pretty(Bitboard b) {
 
   std::string s = "+---+---+---+---+---+---+---+---+\n";
 
index 95591fc4533d79df98962b7d3aff5cdafcbc4458..c9555b6bf7214de2c5092559905872fc236fad15 100644 (file)
@@ -33,7 +33,7 @@ bool probe(Square wksq, Square wpsq, Square bksq, Color us);
 namespace Bitboards {
 
 void init();
-const std::string pretty(Bitboard b);
+std::string pretty(Bitboard b);
 
 }
 
index 48e20a396c400f8f14410f802a3c7b29add9ab73..fe920140dbaf3ca4aaab00e1469ce68d8bda32eb 100644 (file)
@@ -138,7 +138,7 @@ public:
 /// the program was compiled) or "Stockfish <Version>", depending on whether
 /// Version is empty.
 
-const string engine_info(bool to_uci) {
+string engine_info(bool to_uci) {
 
   const string months("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec");
   string month, day, year;
@@ -161,7 +161,7 @@ const string engine_info(bool to_uci) {
 
 /// compiler_info() returns a string trying to describe the compiler we use
 
-const std::string compiler_info() {
+std::string compiler_info() {
 
   #define stringify2(x) #x
   #define stringify(x) stringify2(x)
index 7b551adee6a2ea8fc058265450e4233196bad0a9..7eb75bc70ec6eac101c52c5f6a52f04cb5211ad8 100644 (file)
@@ -28,8 +28,8 @@
 
 #include "types.h"
 
-const std::string engine_info(bool to_uci = false);
-const std::string compiler_info();
+std::string engine_info(bool to_uci = false);
+std::string compiler_info();
 void prefetch(void* addr);
 void start_logger(const std::string& fname);
 void* std_aligned_alloc(size_t alignment, size_t size);
index 2eb30ca0d2a6d5536f3f4dc6d315bb9cd6d0de66..8f9b7eee89e266bc00e4ca29c0cf50532929d7c1 100644 (file)
@@ -408,7 +408,7 @@ Position& Position::set(const string& code, Color c, StateInfo* si) {
 /// Position::fen() returns a FEN representation of the position. In case of
 /// Chess960 the Shredder-FEN notation is used. This is mainly a debugging function.
 
-const string Position::fen() const {
+string Position::fen() const {
 
   int emptyCnt;
   std::ostringstream ss;
index 3624e29e723738b63c40b894a70adcb0f622f276..e9803756609c1da2df164897deb14af7391491a4 100644 (file)
@@ -87,7 +87,7 @@ public:
   // FEN string input/output
   Position& set(const std::string& fenStr, bool isChess960, StateInfo* si, Thread* th);
   Position& set(const std::string& code, Color c, StateInfo* si);
-  const std::string fen() const;
+  std::string fen() const;
 
   // Position representation
   Bitboard pieces(PieceType pt) const;