[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: So you think you are (or wanna be) a hacker



On Thu, Aug 12, 2004 at 01:51:46PM -0700, Stefan Nicolai O'Rear wrote:
> Using a glibc extension, how about:
>
>    char *configfile;
>
>    asprintf (&configfile, "%s/%s", getenv ("HOME"), cfgfile);
>
> aprintf auto-mallocs a buffer of the right size.
> Be sure to free()!

On Thu, Aug 12, 2004 at 04:22:46PM -0700, Erik Steffl wrote:
>   IMO for stuff like the above the c++ strings should be used (unless 
> there is some reason to use pure C or you really need every bit of 
> performance boost you can get), even in otherwise C source. There's 
> number of C++ fueatures/libs that can be used withotu going fully OO and 
> IMO using containers (STL) at least somewhat is a lot better that 
> juggling pointers (except of special cases maybe).

Egad!  If you're going to go beyond standard C, I'm of the same
persuasion as Kirk: you might as well use a scripting language with a
good C API like python.

Jason



Reply to: