Re: using long long and printf("%m") in debian
Am Samstag 19 August 2006 17:28 schrieb Steve Greenland:
> On 18-Aug-06, 16:48 (CDT), Hendrik Sattler <post@hendrik-sattler.de> wrote:
> > No, %m is, according to printf(2) manpage:
> > m (Glibc extension.) Print output of strerror(errno). No argument
> > is required.
> >
> > So why isn't
> > printf("%s\n",strerror(errno));
> > used instead of
> > printf("%m\n");
> > ?
> > Not like a problem in Debian GNU/* but you should tell upstream about
> > questionable coding style and portability.
>
> The "%m" idiom is pretty widespread, actually, and not only a Glibc
> extension. But the "strerror(errno)" form is definitely superior for
> portability.
And there is always perror() which is something like:
printf("%s%s%s\n",(s?s:""),(s?": ":""),strerror(errno));
So, using something like:
perror(__FUNCTION__);
of
perror(NULL);
is probably a good idea.
HS
Reply to: