I have not actively worked on Tinker for quite a few years, but from time to time I do compile and run it.
My current PC has Microsoft Visual Studio Community 2019 Version 16.6.5 running under Win10 Pro.
Amazingly, MSVC-2019 compiles Tinker.
This is no small feat; Tinker is pure Frankenstein code, some of which goes back more than 20 years.
Prior MSVS updates would often balk with errors.
So, I was pleasantly surprised when the 2019 MSVC was able to produce an exe.
And it ran.
But, there were strange results; it did not crash, but it was weak.
At some seemingly random points in a game, the eval would bounce around, switching between zero and 30.
Endgames would see shuffling.
This would happen with both the Release and the Debug versions.
So, I tried an older exe from a prior MSVC version (don't recall which specific one).
And, Tinker was back to it's old self.
Not great, but not terrible either.
Tinker has sooo much code and it is such a mess, I doubt that I could isolate much of anything related to this issue.
But, I just thought I would mention it.
Regards,
Brian
MSVS-2019 Oddity
Moderators: hgm, Rebel, chrisw
-
- Posts: 1564
- Joined: Thu Jul 16, 2009 10:47 am
- Location: Almere, The Netherlands
Re: MSVS-2019 Oddity
The source code of Nightmare is pretty much a mess too, this always happens when you do a miriad of experiments. On the other hand it is rather stable and I don't feel the urge to clean it up.brianr wrote: ↑Tue Sep 22, 2020 1:28 am I have not actively worked on Tinker for quite a few years, but from time to time I do compile and run it.
My current PC has Microsoft Visual Studio Community 2019 Version 16.6.5 running under Win10 Pro.
Amazingly, MSVC-2019 compiles Tinker.
This is no small feat; Tinker is pure Frankenstein code, some of which goes back more than 20 years.
Prior MSVS updates would often balk with errors.
So, I was pleasantly surprised when the 2019 MSVC was able to produce an exe.
And it ran.
But, there were strange results; it did not crash, but it was weak.
At some seemingly random points in a game, the eval would bounce around, switching between zero and 30.
Endgames would see shuffling.
This would happen with both the Release and the Debug versions.
So, I tried an older exe from a prior MSVC version (don't recall which specific one).
And, Tinker was back to it's old self.
Not great, but not terrible either.
Tinker has sooo much code and it is such a mess, I doubt that I could isolate much of anything related to this issue.
But, I just thought I would mention it.
Regards,
Brian
I use 3 compilers, MSVC 16.7.4 (it currently is), CLang 10 (clang-cl comes with Visual Studio Pro, I don't know if the Community version has it) and Intel C++ 19.1. I always check on several positions (with a single thread) if the exe's produced by these compilers show the same node-count.
What I usually see is that operator precedence produces problems, for instance (a && B || c) while it should be ((a && b) || c), on some compilers it does what you want and on others it doesn't.
For me MSVC is pretty much stable at the moment, on some occasions I thought that I found a compiler bug, but it was always my own mistake. In practice I use CLang the most though because it produces slightly faster exe's.
I dont know if the VS Community Edition also has the capability to integrate clang-cl (you have to download it separately with the installer), if it does you can also try that one. You can also install LLVM and integrate clang-cl in VS yourself, but this is not as easy as clicking a single checkbox.
-
- Posts: 2559
- Joined: Fri Nov 26, 2010 2:00 pm
- Location: Czech Republic
- Full name: Martin Sedlak
Re: MSVS-2019 Oddity
I think you meant a || b && cJoost Buijs wrote: ↑Tue Sep 22, 2020 8:13 am What I usually see is that operator precedence produces problems, for instance (a && B || c) while it should be ((a && b) || c), on some compilers it does what you want and on others it doesn't.
Anyway, yes the compiler is good, but the VS IDE is very unstable and buggy these days
What I've noticed that in some cases the editor deletes part of an expression while typing (to the right) which is actually very dangerous.
I don't remember the exact conditions when this happens, but it's annoying.
cheng is very messy as well, but pretty stable as far as I'm concerned
Martin Sedlak
-
- Posts: 2488
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: MSVS-2019 Oddity
That sounds like there are code issues. It's common that more recent compilers are more sensitive with undefined behaviour. Means, code that has always been broken but worked with older compilers visibly breaks with newer ones. I recommend compiling it with different compilers like GCC and Clang with warnings enabled (-Wall -Wextra , maybe -Wpedantic), then fixing the warnings. Afterwards, using CppCheck (nice and free GUI tool) to find further suspicious code parts.
Rasmus Althoff
https://www.ct800.net
https://www.ct800.net
-
- Posts: 2559
- Joined: Fri Nov 26, 2010 2:00 pm
- Location: Czech Republic
- Full name: Martin Sedlak
Re: MSVS-2019 Oddity
recent VS2019 has experimental support for address sanitizer, so you can perhaps try that. I've had mixed results though, there seem to be FPs in some cases in 64-bit mode...
Martin Sedlak
-
- Posts: 1564
- Joined: Thu Jul 16, 2009 10:47 am
- Location: Almere, The Netherlands
Re: MSVS-2019 Oddity
mar wrote: ↑Tue Sep 22, 2020 11:13 amI think you meant a || b && cJoost Buijs wrote: ↑Tue Sep 22, 2020 8:13 am What I usually see is that operator precedence produces problems, for instance (a && B || c) while it should be ((a && b) || c), on some compilers it does what you want and on others it doesn't.
Anyway, yes the compiler is good, but the VS IDE is very unstable and buggy these days
What I've noticed that in some cases the editor deletes part of an expression while typing (to the right) which is actually very dangerous.
I don't remember the exact conditions when this happens, but it's annoying.
cheng is very messy as well, but pretty stable as far as I'm concerned
I noticed too that the editor sometimes deletes part of an expression (or the whole line to the right) while editing.
When this happens I just type ctrl-Z, editing the expression for the second time usually works fine.
It is possible to circumvent this bug by disabling one of the C++ editor auto features, unfortunately I forgot which one.
-
- Posts: 536
- Joined: Thu Mar 09, 2006 3:01 pm
Re: MSVS-2019 Oddity
Thanks for all of the suggestions.
So, I compiled with /Wall to see all of the warnings using the current (default) MSVC compiler.
There were more than 16,000.
After fiddling a bit, there were then more than 19,000.
Most of them seemed to be in Windows library headers of some sort.
This was unmanageable.
Redid with /W1 which the help info said was only the most "severe" warnings.
Now there were only 337 warnings!
One of them was a redefinition of "INFINITY", which was also in some library headers.
So, I changed "my" infinity name (alpha/beta max values) and viola...it seems to work properly.
I guess those alpha/beta search limit values explain the odd evals bouncing around between 0 and 30.
Now there are "only" 283 W1 level warnings.
Most of those are related to this type of code:
typedef enum {EMPTY,PAWN,KNIGHT,BISHOP,ROOK,QUEEN,KING};
with the message
warning C4091: 'typedef ': ignored on left of '' when no variable is declared
In more current C parlance, what should that code say?
Thanks again.
PS I'm sure there are more, but it has been a very good start.
So, I compiled with /Wall to see all of the warnings using the current (default) MSVC compiler.
There were more than 16,000.
After fiddling a bit, there were then more than 19,000.
Most of them seemed to be in Windows library headers of some sort.
This was unmanageable.
Redid with /W1 which the help info said was only the most "severe" warnings.
Now there were only 337 warnings!
One of them was a redefinition of "INFINITY", which was also in some library headers.
So, I changed "my" infinity name (alpha/beta max values) and viola...it seems to work properly.
I guess those alpha/beta search limit values explain the odd evals bouncing around between 0 and 30.
Now there are "only" 283 W1 level warnings.
Most of those are related to this type of code:
typedef enum {EMPTY,PAWN,KNIGHT,BISHOP,ROOK,QUEEN,KING};
with the message
warning C4091: 'typedef ': ignored on left of '' when no variable is declared
In more current C parlance, what should that code say?
Thanks again.
PS I'm sure there are more, but it has been a very good start.
-
- Posts: 1784
- Joined: Wed Jul 03, 2019 4:42 pm
- Location: Netherlands
- Full name: Marcel Vanthoor
Re: MSVS-2019 Oddity
Typedef defines a type, but you don't, in your code. You use typedef, but you don't give your type a name (which you could then use to assign this type to a variable). Therefore the compiler omits typedef, and it defines: EMPTY = 0, PAWN = 1, KINGHT = 2.... as constants.brianr wrote: ↑Tue Sep 22, 2020 2:55 pm Now there are "only" 283 W1 level warnings.
Most of those are related to this type of code:
typedef enum {EMPTY,PAWN,KNIGHT,BISHOP,ROOK,QUEEN,KING};
with the message
warning C4091: 'typedef ': ignored on left of '' when no variable is declared
In more current C parlance, what should that code say?
To give it a name, you'd do:
Code: Select all
typedef enum {
EMPTY,
PAWN,
KNIGHT,
BISHOP,
ROOK,
QUEEN,
KING
} Pieces;
Code: Select all
typedef enum Pieces {
EMPTY,
PAWN,
KNIGHT,
BISHOP,
ROOK,
QUEEN,
KING
};
(The type being "enum Pieces")
typedef enum Pieces Pieces
(Rename / Alias "enum Pieces" to "Pieces".)
-
- Posts: 536
- Joined: Thu Mar 09, 2006 3:01 pm
Re: MSVS-2019 Oddity
Right.
All I wanted was the constant definitions.
I could do them explicitly, but it would be annoying for these:
typedef enum {A1,B1,C1,D1,E1,F1,G1,H1, // in bitmaps most significant bit is A1
A2,B2,C2,D2,E2,F2,G2,H2, // but counted as bit 0 so A1-H1 is rank 0
A3,B3,C3,D3,E3,F3,G3,H3, // and white advances by shifting right
A4,B4,C4,D4,E4,F4,G4,H4,
A5,B5,C5,D5,E5,F5,G5,H5,
A6,B6,C6,D6,E6,F6,G6,H6,
A7,B7,C7,D7,E7,F7,G7,H7,
A8,B8,C8,D8,E8,F8,G8,H8};
What is the preferred way to do this?
All I wanted was the constant definitions.
I could do them explicitly, but it would be annoying for these:
typedef enum {A1,B1,C1,D1,E1,F1,G1,H1, // in bitmaps most significant bit is A1
A2,B2,C2,D2,E2,F2,G2,H2, // but counted as bit 0 so A1-H1 is rank 0
A3,B3,C3,D3,E3,F3,G3,H3, // and white advances by shifting right
A4,B4,C4,D4,E4,F4,G4,H4,
A5,B5,C5,D5,E5,F5,G5,H5,
A6,B6,C6,D6,E6,F6,G6,H6,
A7,B7,C7,D7,E7,F7,G7,H7,
A8,B8,C8,D8,E8,F8,G8,H8};
What is the preferred way to do this?
-
- Posts: 2488
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: MSVS-2019 Oddity
Then you don't need to introduce a type that you won't be using anyway. In that case, you can go without typedef:
Code: Select all
enum E_PIECE {EMPTY,PAWN,KNIGHT,BISHOP,ROOK,QUEEN,KING};
enum E_COORDS {
A1,B1,C1,D1,E1,F1,G1,H1,
A2,B2,C2,D2,E2,F2,G2,H2,
A3,B3,C3,D3,E3,F3,G3,H3,
A4,B4,C4,D4,E4,F4,G4,H4,
A5,B5,C5,D5,E5,F5,G5,H5,
A6,B6,C6,D6,E6,F6,G6,H6,
A7,B7,C7,D7,E7,F7,G7,H7,
A8,B8,C8,D8,E8,F8,G8,H8
};
Rasmus Althoff
https://www.ct800.net
https://www.ct800.net