This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Declare reallocarray by default


On 08/29/2018 01:14 AM, Carlos O'Donell wrote:
On 08/28/2018 11:15 AM, Florian Weimer wrote:
In <https://sourceware.org/ml/libc-alpha/2014-05/msg00506.html>,
Joseph suggested to use __USE_GNU for this function, but since most
of the BSDs and Illumos have it, I think __USE_MISC is more
appropriate.  We have seen some reports of implicit function
declarations, resulting in pointer truncation.  Declaring the
function for _DEFAULT_SOURCE (i.e., by default, as long as -ansi
isn't specified) would avoid such problems.

This seems reasonable to me. The choice of __USE_GNU was perhaps a
conservative one since it requires _GNU_SOURCE to be defined on the
user side and that enables a lot of extensions. Relaxing reallocarray
to __USE_MISC is a good choice if we are seeing developer problems
with this e.g. reallocarray is detected in some way at runtime, but
with the prototype missing (and compiler warnings ignored), and the
default signature resulting in pointer truncation (int). It's also
a good choice because the BSDs already have it.

Joseph, do you have any comment on this?

Thanks,
Florian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]