[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: should asprintf and friends guarantee sane pointer on failure?
From: |
Dmitry V. Levin |
Subject: |
Re: should asprintf and friends guarantee sane pointer on failure? |
Date: |
Mon, 29 Jul 2024 18:23:50 +0300 |
On Mon, Jul 29, 2024 at 09:58:57AM -0500, Eric Blake wrote:
> On Mon, Jul 29, 2024 at 04:35:57PM GMT, Bruno Haible wrote:
> > Hi Eric,
> >
> > I see two — mostly unrelated — topics in your mail and the referenced
> > threads.
> >
> > 1) The coding paradigm.
>
> >
> > The only reasonable change that should be done is to mark the
> > declaration of asprintf and vasprintf with attribute
> > __warn_unused_result__. This way, the compiler will warn about
> > the crappy code.
>
> Makes sense; I would be in favor of that change in gnulib (and maybe
> can convince Florian to consider that in glibc)
In glibc the attribute is there since 2006, see
https://sourceware.org/cgit/glibc/commit/?id=11bf311edc7
Old git commits in glibc repository is a mess, but they are still somewhat
usable.
--
ldv