Title
Should <math.h> declare ::lerp?
Status
c++23
Section
[support.c.headers.other]
Submitter
Jiang An

Created on 2022-09-17.00:00:00 last changed 13 months ago

Messages

Date: 2022-11-17.00:42:33

Proposed resolution:

This wording is relative to N4917.

  1. Modify [support.c.headers.other] as indicated:

    -1- Every C header other than <complex.h> ([complex.h.syn]), <iso646.h> ([iso646.h.syn]), <stdalign.h> ([stdalign.h.syn]), <stdatomic.h> ([stdatomic.h.syn]), <stdbool.h> ([stdbool.h.syn]), and <tgmath.h> ([tgmath.h.syn]), each of which has a name of the form <name.h>, behaves as if each name placed in the standard library namespace by the corresponding <cname> header is placed within the global namespace scope, except for the functions described in [sf.cmath], the std::lerp function overloads ([c.math.lerp]), the declaration of std::byte ([cstddef.syn]), and the functions and function templates described in [support.types.byteops]. […]

Date: 2022-11-12.00:00:00

[ 2022-11-12 Approved at November 2022 meeting in Kona. Status changed: Voting → WP. ]

Date: 2022-10-15.00:00:00

[ 2022-10-12; Reflector poll ]

Set status to Tentatively Ready after six votes in favour during reflector poll.

Date: 2022-09-17.00:00:00

According to [support.c.headers.other]/1, <math.h> is required to provide ::lerp, despite that it is a C++-only component. In P0811R3, neither <math.h> nor C compatibility is mentioned, so it seems unintended not to list lerp as an exception in [support.c.headers.other].

Currently there is implementation divergence: libstdc++ provide ::lerp in <math.h> but not in <cmath>, while MSVC STL and libc++ don't provide ::lerp in <math.h> or <cmath> at all.

I'm not sure whether this should be considered together with LWG 3484. Since nullptr_t has become a part of the C standard library as of C23 (see WG14-N3042 and WG14-N3048), I believe we should keep providing ::nullptr_t in <stddef.h>.

History
Date User Action Args
2023-11-22 15:47:43adminsetstatus: wp -> c++23
2022-11-17 00:42:33adminsetmessages: + msg13079
2022-11-17 00:42:33adminsetstatus: voting -> wp
2022-11-08 03:46:49adminsetstatus: ready -> voting
2022-10-12 14:38:10adminsetmessages: + msg12854
2022-10-12 14:38:10adminsetstatus: new -> ready
2022-09-17 17:50:50adminsetmessages: + msg12777
2022-09-17 00:00:00admincreate