Pelles C forum

Pelles C => General discussions => Topic started by: Danielm103 on November 19, 2006, 11:53:23 PM

Title: Hi Bit heads
Post by: Danielm103 on November 19, 2006, 11:53:23 PM
Hi everyone, I am new here and I am new to C. I know a little C# but I am here because I want to learn all the C's - C, C++ and C#.  My first programming languages where Lisp and C# which was great to start off with but I feel I want to get closer to the machine.

Thanks Pelle for setting this all up!

Dan

P.S.
It seems this board needs to cleaned up a little  :cry:
Title: Hi Bit heads
Post by: Greg on November 20, 2006, 03:41:08 AM
Hi Dan,

Pelle has been conspicuously absent from here for several weeks now, I hope he's OK.

Anyway, you picked a great C compiler to learn C with. There are some good C programmers that hang around here too.

Cheers,
Title: Hi Bit heads
Post by: Danielm103 on November 22, 2006, 06:29:35 AM
Hi Greg,

Thanks for the reply, Maybe Pelle is on vacation at some Caribbean island, hanging on the beach drinking margaritas.  8)

Your right, this compiler is awesome. I was just in a challenge over at TheSwam.Org
http://www.theswamp.org/index.php?topic=13609.0
My first C programs performed very well  =D> . I'm really liking the performance that C has to offer. I hope I can be a contributor to this board. I have attached a copy of my first C program (I had help), maybe someone can make it even faster 

Dan

I could not attach the test data as it was too large but you can get it from the swamp if your interested
Title: Hi Bit heads
Post by: severach on November 22, 2006, 10:59:42 PM
Both your strings have buffer overflow.
       TallyResult = (char *)malloc(64);
       ToString(TallyResult, 256, result);
       TimeResult = (char *)malloc(64);
       ToSeconds(TimeResult, 256, diff);

If the size is always 64, why not

 char TallyResult[64];
 _snprintf(TallyResult, sizeof(TallyResult), "%f", result);
Title: Hi Bit heads
Post by: Danielm103 on November 23, 2006, 05:05:42 AM
Severach, Oh now that I see your code, I see the rookie mistake I have made. :oops:
Thank you for taking the time to review my code.