Skip to content

Commit 9b1274a

Browse files
antoinechampionvondele
authored andcommitted
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 #3328 No functional change
1 parent 0f3f5d8 commit 9b1274a

File tree

7 files changed

+9
-8
lines changed

7 files changed

+9
-8
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Ali AlZhrani (Cooffe)
2424
Andrew Grant (AndyGrant)
2525
Andrey Neporada (nepal)
2626
Andy Duplain
27+
Antoine Champion (antoinechampion)
2728
Aram Tumanian (atumanian)
2829
Arjun Temurnikar
2930
Auguste Pop

src/bitboard.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ inline Bitboard safe_destination(Square s, int step) {
5555
/// Bitboards::pretty() returns an ASCII representation of a bitboard suitable
5656
/// to be printed to standard output. Useful for debugging.
5757

58-
const std::string Bitboards::pretty(Bitboard b) {
58+
std::string Bitboards::pretty(Bitboard b) {
5959

6060
std::string s = "+---+---+---+---+---+---+---+---+\n";
6161

src/bitboard.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ bool probe(Square wksq, Square wpsq, Square bksq, Color us);
3333
namespace Bitboards {
3434

3535
void init();
36-
const std::string pretty(Bitboard b);
36+
std::string pretty(Bitboard b);
3737

3838
}
3939

src/misc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class Logger {
138138
/// the program was compiled) or "Stockfish <Version>", depending on whether
139139
/// Version is empty.
140140

141-
const string engine_info(bool to_uci) {
141+
string engine_info(bool to_uci) {
142142

143143
const string months("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec");
144144
string month, day, year;
@@ -161,7 +161,7 @@ const string engine_info(bool to_uci) {
161161

162162
/// compiler_info() returns a string trying to describe the compiler we use
163163

164-
const std::string compiler_info() {
164+
std::string compiler_info() {
165165

166166
#define stringify2(x) #x
167167
#define stringify(x) stringify2(x)

src/misc.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828

2929
#include "types.h"
3030

31-
const std::string engine_info(bool to_uci = false);
32-
const std::string compiler_info();
31+
std::string engine_info(bool to_uci = false);
32+
std::string compiler_info();
3333
void prefetch(void* addr);
3434
void start_logger(const std::string& fname);
3535
void* std_aligned_alloc(size_t alignment, size_t size);

src/position.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ Position& Position::set(const string& code, Color c, StateInfo* si) {
408408
/// Position::fen() returns a FEN representation of the position. In case of
409409
/// Chess960 the Shredder-FEN notation is used. This is mainly a debugging function.
410410

411-
const string Position::fen() const {
411+
string Position::fen() const {
412412

413413
int emptyCnt;
414414
std::ostringstream ss;

src/position.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class Position {
8787
// FEN string input/output
8888
Position& set(const std::string& fenStr, bool isChess960, StateInfo* si, Thread* th);
8989
Position& set(const std::string& code, Color c, StateInfo* si);
90-
const std::string fen() const;
90+
std::string fen() const;
9191

9292
// Position representation
9393
Bitboard pieces(PieceType pt) const;

0 commit comments

Comments
 (0)