[Sussex] Re: C programming help

Captain Redbeard hairy.one at virgin.net
Wed May 11 05:28:21 UTC 2005


Geoffrey Teale wrote:

 > BTW.. Redbeard - don't be too disheartened by the number of
 > problems
 > that Valgrind finds - I recently ran it over some code
 > that
 > had been in
 > use for several years and it found close to 400 problems,
 > none of which
 > were the issue I was trying to solve in the code!

Alright, but I'm a bit of a perfectionist and would prefer 
my code to have no errors at all even if that's a near 
impossibility.  Besides, memory allocation is one area I'm 
still trying to get my head around so I don't always 
necessarily know if what I think should work actually does 
work (though I'm learning fast!).

 > There is real value in getting a decent understanding of
 > memory
 > allocation, reallocation and freeing so don't be
 > discouraged, it's a
 > fight worth fighting.

Hope so. :)

The main reason I'm writing the program in C is so that I 
can really get inside the language and learn it well, even 
though I've opted for an OOP-style approach that would 
probably be better suited to Java or C++.  It's just a 
little annoying sometimes how long it is taking to get what 
is essentially quite a simple program stable enough to be 
released.  On the other hand I have BIG plans for it so it's 
probably best to get it right the first time.

Oh, and finally, IS there anything wrong with the line 
"strncpy (TestStructPtr->CharString, "Hello World!\n\n\n", 
13);" and why am I getting that error message from Valgrind?



-- 
Captain Redbeard



======================================================
Insomnia - it's not a condition, it's a mentality.
Registered Linux user: 388693.
Registered Linux machines: 289172, 289173.
v2sw5+8C+JGhw5ln4/5pr6/7Ock1ma6/8l6+8Sw3+2e4t2b9Hen4+6
g5+3RHaIr9 Hackerkey.com
======================================================




More information about the Sussex mailing list