I was able to port a C engine where the author only supplied a Windows EXE to a totally different platform that doesn't even have an OS. Good luck trying that with another language.abulmo2 wrote:3) In C or C++, a chess engine has some parts tied to the OS (time-management, non blocking input and multithreading), so writing a portable code in C or C++ usually needs wrapper around some OS-dedicated library functions.
Programming language choice, why C\C++ ?
Moderators: hgm, Rebel, chrisw
-
- Posts: 2495
- Joined: Tue Aug 30, 2016 8:19 pm
- Full name: Rasmus Althoff
Re: Programming language choice, why C\C++ ?
-
- Posts: 4368
- Joined: Fri Mar 10, 2006 5:23 am
- Location: http://www.arasanchess.org
Re: Programming language choice, why C\C++ ?
Ages ago I had to port an application to MS-DOS. There were some existing implementations on other platforms. The closest one to MS-DOS targeted an embedded system (no OS). MS-DOS was so primitive it might as well not have had any OS functions. So I cross-compiled the app on VMS and targeted a runtime library that was a hacked version of the embedded system's and sat on MS-DOS. The most painful part of this was actually having to use VMS .
--Jon
--Jon
-
- Posts: 8
- Joined: Wed Jul 13, 2011 12:00 pm
- Location: Berlin
Re: Programming language choice, why C\C++ ?
I had the same question about 8 or 9 years ago especially with D! (It looked so great to me).
And some clever guys told me that C/C++ is also better in bit fiddeling if you want to use bitboards!
This might be a strong argument against D, Go, Rust, etc.
But if you don't need bit operations, other languages like D might also be fine.
And some clever guys told me that C/C++ is also better in bit fiddeling if you want to use bitboards!
This might be a strong argument against D, Go, Rust, etc.
But if you don't need bit operations, other languages like D might also be fine.
-
- Posts: 434
- Joined: Fri Dec 16, 2016 11:04 am
- Location: France
- Full name: Richard Delorme
Re: Programming language choice, why C\C++ ?
This is wrong:edlich wrote:And some clever guys told me that C/C++ is also better in bit fiddeling if you want to use bitboards!
This might be a strong argument against D, Go, Rust, etc.
D: https://dlang.org/phobos/core_bitop.html
Rust: https://doc.rust-lang.org/std/primitive.u64.html
Go: this is under discussion: https://github.com/golang/go/issues/18616
All those languages also support inline assembly in case the default implementation is too slow.
There is nothing standard in C or C++. You have to use compiler extensions (builtin, intrinsics, etc.), or inline assembly if supported.
Richard Delorme
-
- Posts: 8
- Joined: Wed Jul 13, 2011 12:00 pm
- Location: Berlin
Re: Programming language choice, why C\C++ ?
Oh thanks.
Then my info must be too old.
Then my info must be too old.