On 08 March 2007 11:46, Paulo J. Matos wrote: > Hello all, > > when using functions from libiberty, I'm for example using xstrdup and > xmalloc but free is not defined as free or xfree afail nor strlen so > how should I include things? Before system.h and then standard libs or > the other way around? > > I am almost sure it should be the other way around but I would like > confirmation on this.
Huh? I don't quite get you here. For example, xmalloc is a wrapper around the system malloc; all it does is calls malloc and checks the result isn't NULL. So you don't need any xfree; just call the ordinary system free. Same goes for xstrdup; it's just a wrapper around the standard strdup implementation that guarantees it won't fail; since strlen doesn't allocate any memory and can't fail, there's no need for a xstrlen function. In any case, it's not a matter of include file ordering; you should have no need to do anything other than just stick to the usual ordering, which is standard library files first, application files last. There's libiberty documentation available online at DJ's homepage: http://www.delorie.com/gnu/docs/gcc/libiberty.html (Also, bear in mind that if you want your new pass to work correctly with pre-compiled headers, you really ought to be using Gcc's garbage-collected memory management facilities. See http://gcc.gnu.org/onlinedocs/gccint/Type-Information.html#Type-Information for the full gory details....) cheers, DaveK -- Can't think of a witty .sigline today....