On Fri, Jun 28, 2013 at 08:18:50AM +0300, Edgaras wrote:
> On Thu, Jun 27, 2013 at 07:01:52PM +0200, Markus Wichmann wrote:
> > The function you are looking for is called asprintf().
> 
> Isn't asprintf just GNU extension? An IIRC such things a kinda mostly frown
> upon here? Though it sure sounds as very nice function.

Uh... maybe. The manpage states (reformated to fit the mail):

| CONFORMING TO
| 
| These functions are GNU extensions, not in C or POSIX.  They are also
| available under *BSD.  The FreeBSD implementation sets strp to NULL on
| error.

However, absence from standards doesn't necessarily mean it sucks.
Compare stuff like openpty().

I have seen this function in musl, and I guess the other major libcs do
provide it, too. At least, at work the other day I compiled a rather
large collection of programs against uClibc (including upstart and
dbus), and I never had a problem because of asprintf(), though I did
have problems because of other things. (Some ptrace constants were
missing - Yeah, upstart ptraces all the processes it starts, in order to
detect daemonizations. OK, you could use a program like pidfilehack for
that, but no.)

Ciao,
Markus

Reply via email to