[Discuss] Casting the return value of malloc bad?

George Farris farrisg at shaw.ca
Sat Jul 15 18:14:57 PDT 2006


On Sat, 2006-15-07 at 13:48 -0700, Adam Parkin wrote:
> Andrew Resch wrote:
> >> Paul Nienaber wrote:
> >>> Do it this way:
> >>>
> >>> foo = malloc(n * sizeof(*foo));
>  >>

If you are going to be doing stuff like this in C you should maybe have
a look at glib.  The lower level library used with gtk.  It has some
very nice routines for C programmers even if they aren't using gtk.

-- 
George Farris
farrisg at shaw.ca




More information about the Discuss mailing list