1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-05-02 17:49:35 +00:00

Clean functions returning by const values

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
This commit is contained in:
Antoine Champion 2021-01-30 09:50:04 +01:00 committed by Joost VandeVondele
parent 0f3f5d85fb
commit 9b1274aba3
7 changed files with 9 additions and 8 deletions

View file

@ -24,6 +24,7 @@ Ali AlZhrani (Cooffe)
Andrew Grant (AndyGrant) Andrew Grant (AndyGrant)
Andrey Neporada (nepal) Andrey Neporada (nepal)
Andy Duplain Andy Duplain
Antoine Champion (antoinechampion)
Aram Tumanian (atumanian) Aram Tumanian (atumanian)
Arjun Temurnikar Arjun Temurnikar
Auguste Pop Auguste Pop

View file

@ -55,7 +55,7 @@ inline Bitboard safe_destination(Square s, int step) {
/// Bitboards::pretty() returns an ASCII representation of a bitboard suitable /// Bitboards::pretty() returns an ASCII representation of a bitboard suitable
/// to be printed to standard output. Useful for debugging. /// 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"; std::string s = "+---+---+---+---+---+---+---+---+\n";

View file

@ -33,7 +33,7 @@ bool probe(Square wksq, Square wpsq, Square bksq, Color us);
namespace Bitboards { namespace Bitboards {
void init(); void init();
const std::string pretty(Bitboard b); std::string pretty(Bitboard b);
} }

View file

@ -138,7 +138,7 @@ public:
/// the program was compiled) or "Stockfish <Version>", depending on whether /// the program was compiled) or "Stockfish <Version>", depending on whether
/// Version is empty. /// 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"); const string months("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec");
string month, day, year; 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 /// 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 stringify2(x) #x
#define stringify(x) stringify2(x) #define stringify(x) stringify2(x)

View file

@ -28,8 +28,8 @@
#include "types.h" #include "types.h"
const std::string engine_info(bool to_uci = false); std::string engine_info(bool to_uci = false);
const std::string compiler_info(); std::string compiler_info();
void prefetch(void* addr); void prefetch(void* addr);
void start_logger(const std::string& fname); void start_logger(const std::string& fname);
void* std_aligned_alloc(size_t alignment, size_t size); void* std_aligned_alloc(size_t alignment, size_t size);

View 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 /// 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. /// Chess960 the Shredder-FEN notation is used. This is mainly a debugging function.
const string Position::fen() const { string Position::fen() const {
int emptyCnt; int emptyCnt;
std::ostringstream ss; std::ostringstream ss;

View file

@ -87,7 +87,7 @@ public:
// FEN string input/output // FEN string input/output
Position& set(const std::string& fenStr, bool isChess960, StateInfo* si, Thread* th); Position& set(const std::string& fenStr, bool isChess960, StateInfo* si, Thread* th);
Position& set(const std::string& code, Color c, StateInfo* si); Position& set(const std::string& code, Color c, StateInfo* si);
const std::string fen() const; std::string fen() const;
// Position representation // Position representation
Bitboard pieces(PieceType pt) const; Bitboard pieces(PieceType pt) const;