On Thu, 2008-11-27 at 12:59 -0500, steve uurtamo wrote:
> don,
> 
> i agree, although i will point out one of C's biggest flaws, which
> happens (conveniently for the sake of this argument) to be its
> least important one for game programming:
> 
> string handling sucks
> 
> if i never have to handle a string, i'll choose C without question.
> when i need to handle strings, i choose C with major reservations.


Yes, string handling is very low level and primitive in C.  However it
doesn't seem much better in Java, if you are talking about Java.

Can it be worse than this?  :

  if (string1.equals(string2)) {
     ... do stuff
  } 

Ok, it's probably a little worse in C,  but Java is no giant in string
handling.  

  the C way:

  if (!strcmp(string1, string2)) {
     ... do stuff
  }


A lot of times this comes down to what is abstracted away from your
control.   For instance in C you can do tricks with pointer magic to
speed things up.   In Java, some of this also happens underneath the
hood, for instance string space can be shared.    I think the substring
method in Java doesn't allocate more space for storing the characters,
although it must need to create a new object.   But my point is that all
of this is outside the control of the programmer, at least without
herculean efforts.   That is almost always bad for performance
programming, when the compiler doesn't really know what you really
intend to do and makes too many decisions for you.

Of course there is another myth about this and it's not uncommon to see
blogs or diatribes about how compilers are much smarter than humans
about making decisions.   I'm completely in favor of automating things
like memory management,  instruction scheduling, and other low level
details that I don't want to be bothered with,  but I disagree that
humans cannot compete.   The truth is that most humans don't want to be
bothered with this because it's difficult, and we would rather have a
compiler make a good decision than for ourselves to have to take a lot
of time and effort making a better decision.     Having said that, there
probably are specialized cases where even expert humans would be
significantly challenged to outperform a compiler in any significant
way.  


- Don






> 
> s.

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
computer-go mailing list
computer-go@computer-go.org
http://www.computer-go.org/mailman/listinfo/computer-go/

Reply via email to