Which OS is better for chess? Windows or Linux.

Discussion of anything and everything relating to chess playing software and machines.

Moderators: hgm, Rebel, chrisw

mar
Posts: 2554
Joined: Fri Nov 26, 2010 2:00 pm
Location: Czech Republic
Full name: Martin Sedlak

Re: Which OS is better for chess? Windows or Linux.

Post by mar »

lucasart wrote: Sat Nov 03, 2018 2:02 am I used to like IDEs, and goet fed up. Was using Codelite, and Code::Blocks. I guess these IDEs are good for doing GUI programming, although Qt Creator is probably a better choice for that.

But for chess programming, I just use a terminal. Plain and simple. Text Editor + Clang/GCC. I'm not going to say which text editor, because that can start a flamewar.

I also gave up on using debuggers. That has forced me to be more careful in the way I write and test code. Basically, I want to write code that debugs itself. And otherwise, I use good old-fashion printf() debugger.

The thing about chess programming is that is much more about quality than quantity. It's not about IDE features that save some keystrokes with auto-completion, or building some (crappy) Object Oriented boiler plate for you (like click a few buttons to build class hierarchies). It's about writing and maintaining in a holistic manner an extremely dense and precise code-base. For every patch, the time spent typing code is less than 0.1%. The rest is thinking and testing. So even something basic like nano is just fine.
Fair enough, you raise valid points.

I always start a new project in IDEs as empty, I really don't like the crap it generates for me.
Another option is to use cmake or premake, which generate the projects for you for the specific platform/IDE you want.

As for printf debugging, I use logging sometimes when something goes wrong (not in a chess project), but I prefer to use debuggers,
because I don't have to insert printfs everywhere and then delete them (ok, you can do git reset, but still).

Actually debugging is the #1 reason why I use IDEs, I can inspect the contents of variables when I get a crash, this is invaluable and difficult
to do with printfs. Most IDEs also support conditional breakpoints, the reason I like debugging is that it's non-invasive and I can to also inspect
callstacks of other threads, I don't really see a replacement for debuggers in multi-threaded situations.

We have awesome tools today, compilers can do instrumentation (address sanitizers, ...), we have runtime tools like valgrind or dr. memory and
those will catch the most obvious bugs for us, like unaddressable accesses, dangling pointers, uninitialized access and so on, so using a minimalistic setup + terminal is perfectly viable for smaller projects.
Martin Sedlak
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Which OS is better for chess? Windows or Linux.

Post by Ras »

mar wrote: Sat Nov 03, 2018 12:45 pmActually debugging is the #1 reason why I use IDEs, I can inspect the contents of variables when I get a crash, this is invaluable and difficult to do with printfs.
I've used GDB from command line when I had to hunt down a non-obvious occasional segfault in my engine, so that doesn't require an IDE.
Rasmus Althoff
https://www.ct800.net
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Which OS is better for chess? Windows or Linux.

Post by lucasart »

Ras wrote: Sat Nov 03, 2018 1:52 pm
mar wrote: Sat Nov 03, 2018 12:45 pmActually debugging is the #1 reason why I use IDEs, I can inspect the contents of variables when I get a crash, this is invaluable and difficult to do with printfs.
I've used GDB from command line when I had to hunt down a non-obvious occasional segfault in my engine, so that doesn't require an IDE.
And how would you rate your experience ? Would you say that GDB from command line is easy to use ? Some call it the deterrence strategy debugger :lol:
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.
Ras
Posts: 2487
Joined: Tue Aug 30, 2016 8:19 pm
Full name: Rasmus Althoff

Re: Which OS is better for chess? Windows or Linux.

Post by Ras »

lucasart wrote: Sat Nov 03, 2018 2:36 pmAnd how would you rate your experience ? Would you say that GDB from command line is easy to use ?
Well I needed to google how segfault GDB, that got me a nice tutorial website right at the first result link. After that, it was pretty straightforward even in a slightly complicated issue.

I set a catch on SIGSEGV, which brought me to the faulting line, a global pointer dereference. That totally didn't make sense until I let GDB print the value of the pointer, and it pointed into the wild. But why, the pointer wasn't being modified? I let the program run again, this time with a write watch on this pointer. Sure enough, it stopped somewhere totally else. Turned out it was a buffer overrun that overwrote the memory after the buffer, which happened to be this pointer.

Actually, I am on Windows and have Visual Studio 2010 installed, but I don't even know when I used it last time, and I havn't cared to update it. Cygwin is also installed, and I found it easier to just use command line GDB then wrestling with VS.
Rasmus Althoff
https://www.ct800.net
User avatar
lucasart
Posts: 3232
Joined: Mon May 31, 2010 1:29 pm
Full name: lucasart

Re: Which OS is better for chess? Windows or Linux.

Post by lucasart »

mar wrote: Sat Nov 03, 2018 12:45 pmActually debugging is the #1 reason why I use IDEs, I can inspect the contents of variables when I get a crash, this is invaluable and difficult
to do with printfs. Most IDEs also support conditional breakpoints, the reason I like debugging is that it's non-invasive and I can to also inspect
callstacks of other threads, I don't really see a replacement for debuggers in multi-threaded situations.
Indeed, a GDB front end is all we need an IDE for, at least for non-GUI programming (like a chess engine). The rest is just nuisance that gets in the way.

I'll look around to see what's available now. Looke like there are nice and modern applications that do just that (eg. gdbgui, browser based!).
Theory and practice sometimes clash. And when that happens, theory loses. Every single time.