Re: generics and arrays and multi-class collections



On Mon, 01 Oct 2007 20:21:17 -0700, Daniel Pitts
<newsgroup.spamfilter@xxxxxxxxxxxxxxxxxxx> wrote:

I'm not against performance optimizations at all, I'm just saying you
should do it as a last step after you've created the "perfect" design
(perfect being relative). And you should only do it with the help of
profiling tools. In any case, it sounds like you're particular problem
needs optimization. Is there some form of time-limit?

Yeah, the program has 30 seconds for the entire game, which can last
for 200 moves, so I have to fit 100 moves in 30 seconds.

Java is a lot of fun to program in :-). But whats wrong with C? You can
write really elegant programs in C if you know what you're doing. Gotta
love function pointers! :-)

Well, I haven't finished the book I was reading on C so my opinion
might not be final, but....

I don't like the way the variable declarations have their type mixed
with the variable name, that is, a pointer is not char* p, but char
*p, and an array of char ptrs is char *p[], and a ptr to an array is
char (*p)[], but it kinda makes sense because that's also the way
you're going to use the variable.

Also, it's stupid that you dereference by *p instead of p* or p^. I
think that's the main reason they needed to introduce p->field because
you get pretty tired of writing (*p).field.

And then there's the lack of nice basic string manipulation.
Everything is so bloody low-level. It's like you have to make fire
with firestones when you're used to using matches. String ought to be
a type, not a bloody pointer to a piece of memory that may or may not
have a zero somewhere to terminate it.

It's quite cool that you can set up dynamic 3-dimensional arrays but
writing the code is a major headache. I've coded in basic, in pascal,
in assembler and in java, but i'll never code for fun in C, or even
C++.


Well, good luck on your bot competition.

Thanks.
.



Relevant Pages

  • Re: fwrite() misses writing a byte
    ... binary files which is just some marshalled data. ... I presume that Datais a single byte (type char, signed char, or ... then you're just writing the first byte ... meaningful error message. ...
    (comp.lang.c)
  • Re: Access violation in free()
    ... Better: char *CopyString ... writing. ... looking for a new word processor. ...
    (comp.lang.c)
  • Re: Is there a standard way to write an 8 bit byte?
    ... > I would like to write completely platform-independent code if at all ... char is only guaranteed to be at least 8 bits. ... writing a char into a file in binary mode would result in 9 bits being ... There is no cast iron guarantee in the C standard that this will produce the ...
    (comp.lang.c)
  • java.io.FileOutputStream misbehavior
    ... is it right that when writing a file, ... one or two byte get written per char? ... For example you save a String with about 40kbyte into a file. ... When putting a single umlaut in the String, ...
    (comp.lang.java.help)
  • fstream::read(..);
    ... i m using fstream object for reading through and writing to my file, ...
    (comp.lang.cpp)