comp.lang.c.moderated
  Home FAQ Contact Sign in
comp.lang.c.moderated only
 
Advanced search
April 2008
motuwethfrsasuw
 123456 14
78910111213 15
14151617181920 16
21222324252627 17
282930     18
2008
 Jan   Feb   Mar   Apr 
 May   Jun   Jul   Aug 
 Sep   Oct   Nov   Dec 
2008 2007 2006  
total
comp.lang.c.moderated Profile…
RELATED GROUPS

POPULAR GROUPS

more...

 Up
  Is malloc() function provided in <stdlib.h> thread-safe?         


Author: climber.cui
Date: Apr 21, 2008 11:20

Hi all,
Does anyone have experience on the thread-safty issue with malloc()?
Some people said this function provided in stdlib.h is not thread-
safe, but someone said it is thread safe. Is it possible this
function evolves from thread-unsafe to thread-safe in recent years?
How could i find out?
I am using the C library coming with GNU linux distribution.

thanks a lot.

tony
--
comp.lang.c.moderated - moderation address: clcm@plethora.net -- you must
have an appropriate newsgroups line in your header for your mail to be seen,
or the newsgroup name in square brackets in the subject line. Sorry.
7 Comments
  C API Design         


Author: Al
Date: Apr 21, 2008 11:19

Hi there,

I haven't kept up with the latest C best practices. In adapting
(wrapping, mostly) a C++ API which throws on error, which of these might
the better alternative, or are there other options I haven't considered?

/* Assume: */

typedef struct { ... } Error;
struct Foo;

/* Parametric (stateless) version: */
Foo* CreateFoo (int ctorparam, Error *const error);
bool PrintFoo (const Foo *const foo, Error *const error);
bool ReleaseFoo(const Foo *const foo, Error *const error);

/* Static (stateful) version: */
Foo* CreateFoo (int ctorparam);
bool PrintFoo (const Foo *const foo);
bool ReleaseFoo(const Foo *const foo);
Error* LastError ();
Show full article (1.65Kb)
4 Comments