On 12/11/11 16:53, Mathieu Bouchard wrote:
gl_frame_cond = (pthread_cond_t*) malloc(sizeof(pthread_mutex_t));
A nice idiom for malloc is to use the sizeof of the target of the
pointer to which you are assigning its result (no explicit cast needed
when assigning from a void * afaik, at least no warnings/errors here
with gcc (Debian 4.4.5-8) 4.4.5):
$ gcc -std=c99 -Wall -pedantic -Wextra -Wno-unused-parameter \
-o malloc malloc.c
#include <stdlib.h>
struct foo { int bar, baz; double quux; };
int main(int argc, char **argv) {
struct foo *f = malloc(sizeof(*f));
free(f);
return 0;
}
Claude
_______________________________________________
[email protected] mailing list
UNSUBSCRIBE and account-management ->
http://lists.puredata.info/listinfo/pd-list