Not any decent (or even semi-decent) system that I know of...michiguel wrote: Is there any system we cannot find a C compiler for it?
c vs c++
Moderators: hgm, Rebel, chrisw
-
- Posts: 900
- Joined: Tue Apr 27, 2010 3:48 pm
Re: c vs c++
-
- Posts: 5106
- Joined: Tue Apr 29, 2008 4:27 pm
Re: c vs c++
There are numerous ways D is superior to C++ and in 1 line of text you have identified just about the only ways C is superior, and I think some of that is even debatable. Still, performance and compiler quality are an issue for me and is why I have not changed over yet. In my own tests D is very close to C in performance, but I really want something closer to 5% and for things with chess-like logic I believe it's something around 10% slower. It's faster than almost any other language claiming to be like C in speed for benchmarks that matter. It is slower in some benchmarks that involve things we dont' care about in chess programs such as regular expressions.rbarreira wrote:Compiler quality, portability, API maturity, performance and famliarity/popularity are all advantages of C/C++ over D.edlich wrote:Concerning the speed comparison there are lots of nice benchmarks outside to answer some questions: http://shootout.alioth.debian.org/ or http://dada.perl.it/shootout/
I really would like to support the excitement for D. One upon a time I have listed a bunch of advantages in the chessprogramming wiki here: http://chessprogramming.wikispaces.com/D-ProglanguageDon wrote:D is better in almost every way - ...Tord Romstad wrote:I have no love for either C or C++, and although D and Go are better in some ways,
Closures and a D-language subset for functional programming is one of the many examples.
Thus it would be interesting to know why still so many chess developers decide to to go for C++. Is it a mass effect? Is it the amount of available (clonable?chess code? Or something more I miss? (and keen to learn!).
Best
Stefan Edlich
When you say C is more portable, you are only half right. C runs on more platforms, but that is where it ends. On the platforms D runs on, the code is more portable than C. Same source runs on windows and linux for instance where you have to go to a lot of trouble in C to separate out platform differences in I/O, timekeeping and other things that shouldn't be.
When you say the API is more mature, I think, "mature as in geriatric, arthritis and dementia." For example some functions in C return errno in a global variable. Is that what you mean by mature? Is the string.h library mature or just dated? Actually, the D language was made to address these issue with a fresh clean start.
If you mean mature because the API isn't changing with each release, then you have a point, but the langue is now stable and mature enough that this is no longer an issue for me.
Popularity does not carry any weight for me, unless it is a symptom of dying language, but D appears to be the real deal and is gaining in popularity and support. I don't choose my languages (or anything else) based on popularity unless there is an actual reason it's more popular. With computer languages there is rarely a valid reason a language is more popular.
-
- Posts: 8
- Joined: Wed Jul 13, 2011 12:00 pm
- Location: Berlin
Re: c vs c++
Oh, this might be a valid and serious point for chessprogrammers. Thanks for this hint! Thanks also to Ricardo Barreira for his good points.Janzert wrote: Not quite chess but certainly using all the same techniques, I wrote an arimaa engine in D (OpFor). I retired it this year to start over with C++ primarily because I was tired of dealing with compiler bugs. While I'm sure the D compilers are probably plenty stable for general code, once it gets down to the (otherwise obscure) bit twiddling that is fairly common in chess or arimaa bitboard engine code running into compiler bugs became a real pain for me.
No stable 64bit compiler and the seemingly constant language evolution were also large negatives for me.
Janzert
All the best, Stefan Edlich
-
- Posts: 900
- Joined: Tue Apr 27, 2010 3:48 pm
Re: c vs c++
The post I replied to was asking why people choose C++ over D, so it wouldn't make sense for me to start enumerating D's advantages. Still, it was interesting to see your opinion of D, thanks for that.Don wrote:There are numerous ways D is superior to C++ and in 1 line of text you have identified just about the only ways C is superior, and I think some of that is even debatable. Still, performance and compiler quality are an issue for me and is why I have not changed over yet. In my own tests D is very close to C in performance, but I really want something closer to 5% and for things with chess-like logic I believe it's something around 10% slower. It's faster than almost any other language claiming to be like C in speed for benchmarks that matter. It is slower in some benchmarks that involve things we dont' care about in chess programs such as regular expressions.rbarreira wrote:Compiler quality, portability, API maturity, performance and famliarity/popularity are all advantages of C/C++ over D.edlich wrote:Concerning the speed comparison there are lots of nice benchmarks outside to answer some questions: http://shootout.alioth.debian.org/ or http://dada.perl.it/shootout/
I really would like to support the excitement for D. One upon a time I have listed a bunch of advantages in the chessprogramming wiki here: http://chessprogramming.wikispaces.com/D-ProglanguageDon wrote:D is better in almost every way - ...Tord Romstad wrote:I have no love for either C or C++, and although D and Go are better in some ways,
Closures and a D-language subset for functional programming is one of the many examples.
Thus it would be interesting to know why still so many chess developers decide to to go for C++. Is it a mass effect? Is it the amount of available (clonable?chess code? Or something more I miss? (and keen to learn!).
Best
Stefan Edlich
When you say C is more portable, you are only half right. C runs on more platforms, but that is where it ends. On the platforms D runs on, the code is more portable than C. Same source runs on windows and linux for instance where you have to go to a lot of trouble in C to separate out platform differences in I/O, timekeeping and other things that shouldn't be.
When you say the API is more mature, I think, "mature as in geriatric, arthritis and dementia." For example some functions in C return errno in a global variable. Is that what you mean by mature? Is the string.h library mature or just dated? Actually, the D language was made to address these issue with a fresh clean start.
If you mean mature because the API isn't changing with each release, then you have a point, but the langue is now stable and mature enough that this is no longer an issue for me.
Popularity does not carry any weight for me, unless it is a symptom of dying language, but D appears to be the real deal and is gaining in popularity and support. I don't choose my languages (or anything else) based on popularity unless there is an actual reason it's more popular. With computer languages there is rarely a valid reason a language is more popular.
BTW I just remembered that D is garbage collected, that can be a problem for real-time programs (which chess engines kind of are, in some situations).
-
- Posts: 5106
- Joined: Tue Apr 29, 2008 4:27 pm
Re: c vs c++
Garbage collection is optional in D, it is not required. You can still use free and malloc I think.rbarreira wrote:The post I replied to was asking why people choose C++ over D, so it wouldn't make sense for me to start enumerating D's advantages. Still, it was interesting to see your opinion of D, thanks for that.Don wrote:There are numerous ways D is superior to C++ and in 1 line of text you have identified just about the only ways C is superior, and I think some of that is even debatable. Still, performance and compiler quality are an issue for me and is why I have not changed over yet. In my own tests D is very close to C in performance, but I really want something closer to 5% and for things with chess-like logic I believe it's something around 10% slower. It's faster than almost any other language claiming to be like C in speed for benchmarks that matter. It is slower in some benchmarks that involve things we dont' care about in chess programs such as regular expressions.rbarreira wrote:Compiler quality, portability, API maturity, performance and famliarity/popularity are all advantages of C/C++ over D.edlich wrote:Concerning the speed comparison there are lots of nice benchmarks outside to answer some questions: http://shootout.alioth.debian.org/ or http://dada.perl.it/shootout/
I really would like to support the excitement for D. One upon a time I have listed a bunch of advantages in the chessprogramming wiki here: http://chessprogramming.wikispaces.com/D-ProglanguageDon wrote:D is better in almost every way - ...Tord Romstad wrote:I have no love for either C or C++, and although D and Go are better in some ways,
Closures and a D-language subset for functional programming is one of the many examples.
Thus it would be interesting to know why still so many chess developers decide to to go for C++. Is it a mass effect? Is it the amount of available (clonable?chess code? Or something more I miss? (and keen to learn!).
Best
Stefan Edlich
When you say C is more portable, you are only half right. C runs on more platforms, but that is where it ends. On the platforms D runs on, the code is more portable than C. Same source runs on windows and linux for instance where you have to go to a lot of trouble in C to separate out platform differences in I/O, timekeeping and other things that shouldn't be.
When you say the API is more mature, I think, "mature as in geriatric, arthritis and dementia." For example some functions in C return errno in a global variable. Is that what you mean by mature? Is the string.h library mature or just dated? Actually, the D language was made to address these issue with a fresh clean start.
If you mean mature because the API isn't changing with each release, then you have a point, but the langue is now stable and mature enough that this is no longer an issue for me.
Popularity does not carry any weight for me, unless it is a symptom of dying language, but D appears to be the real deal and is gaining in popularity and support. I don't choose my languages (or anything else) based on popularity unless there is an actual reason it's more popular. With computer languages there is rarely a valid reason a language is more popular.
BTW I just remembered that D is garbage collected, that can be a problem for real-time programs (which chess engines kind of are, in some situations).
-
- Posts: 5106
- Joined: Tue Apr 29, 2008 4:27 pm
Re: c vs c++
That is definitely an issue which would influence or delay my decision about when to switch over.Janzert wrote:Not quite chess but certainly using all the same techniques, I wrote an arimaa engine in D (OpFor). I retired it this year to start over with C++ primarily because I was tired of dealing with compiler bugs. While I'm sure the D compilers are probably plenty stable for general code, once it gets down to the (otherwise obscure) bit twiddling that is fairly common in chess or arimaa bitboard engine code running into compiler bugs became a real pain for me.edlich wrote:Thus it would be interesting to know why still so many chess developers decide to to go for C++. Is it a mass effect? Is it the amount of available (clonable?chess code? Or something more I miss? (and keen to learn!).
No stable 64bit compiler and the seemingly constant language evolution were also large negatives for me.
Janzert
How long ago was your last bad experience with D bugs? I know the development is very active in D and do you have any experience with reporting and getting bugs fixed (or not fixed) ?
Re: c vs c++
My last active development with D was in February of this year. I think the last compiler bug I ran into was in December or January. The D developers are quite responsive when presented with a reproducible test case. Usually a fix would be out within a few weeks (releases are usually about every 1 to 2 months). Unfortunately new releases seemed to have about a 20% chance of introducing a new incompatibility or bug, so I became rather reluctant to upgrade. On the other hand when I did run into a bug that I tracked down to the compiler, upgrading to the latest version would tend to fix it maybe 25% of the time.Don wrote:That is definitely an issue which would influence or delay my decision about when to switch over.Janzert wrote:Not quite chess but certainly using all the same techniques, I wrote an arimaa engine in D (OpFor). I retired it this year to start over with C++ primarily because I was tired of dealing with compiler bugs. While I'm sure the D compilers are probably plenty stable for general code, once it gets down to the (otherwise obscure) bit twiddling that is fairly common in chess or arimaa bitboard engine code running into compiler bugs became a real pain for me.edlich wrote:Thus it would be interesting to know why still so many chess developers decide to to go for C++. Is it a mass effect? Is it the amount of available (clonable?chess code? Or something more I miss? (and keen to learn!).
No stable 64bit compiler and the seemingly constant language evolution were also large negatives for me.
Janzert
How long ago was your last bad experience with D bugs? I know the development is very active in D and do you have any experience with reporting and getting bugs fixed (or not fixed) ?
Also all my experience is with the D1 version of the language. The promise was to have more stability in D2 but I never made the switch since it hadn't yet stabilized while I was actively developing with D.
I do still like the language itself. I'm just reluctant to spend effort on projects in it until I've seen the language and standard library stabilize in both their specification and implementation. I won't be surprised at all if in a few years it is my favored language for performance critical code.
Janzert
-
- Posts: 20943
- Joined: Mon Feb 27, 2006 7:30 pm
- Location: Birmingham, AL
Re: c vs c++
And the part that deals with any X86 hardware. There are thousands of lines of asm, because there are no C semantics to deal with things that are hardware-specific... For example, how would you access mtrr's (memory type and range registers) to define what areas of memory are cacheable, or that use write-combining, or that are uncacheable, etc. You are always left with asm for those kinds of issues.Michel wrote:C is a reasonable compromise between assembly and a high level language.
Most OS'es are entirely written in C (I think only a tiny part of the Linux kernel is assembly, the part which is concerned with locking primitives for SMP).