[Sussex] Re: C programming help - again!

Geoffrey J. Teale tealeg at member.fsf.org
Wed May 11 18:20:15 UTC 2005


On Wed, 2005-05-11 at 19:00 +0100, Captain Redbeard wrote:
> Good God, I thought I was the only one who did that!  I've 
> already written three or four subroutines that encompass 
> standard library routines adding boundary-checking and other 
> stuff, and I thought I was doing something wrong!

Nope.  Almost every library is just a simplification of something more
general purpose.  However, you should strive to not "reinvent the wheel"
without good cause.

> In the second line of your code you've included a char cast 
> of the malloc() call, why is this cast necessary (I'm 
> assuming it's a cast although the in C '*' is a bit of a 
> swiss army knife)?

Another link for you:

http://www.lysator.liu.se/c/ten-commandments.html

See Commmandment 3


> Anyway, I've just sat down in front of my Emacs box again so 
> I'm sure I'll be posting a few more WTF-type questions again 
> before the end of the night.  Thanks for all your help so far!

Good luck!


-- 
Geoffrey J. Teale <tealeg at member.fsf.org>
Free Software Foundation





More information about the Sussex mailing list