On 2020-09-30 17:58, Joseph Myers wrote:
For some reason http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2529.pdf
doesn't seem to have reached the agenda of a WG14 meeting yet, but adding
a language feature like that to the standard would be another approach.
Hi Joseph,
Yes, that would be
On Tue, 22 Sep 2020 at 19:46, Jonathan Wakely via Libstdc++
wrote:
>
> On 22/09/20 12:25 -0400, Rich Felker wrote:
> >Is there really a reason to want a nonstandard macro like this to do
> >something that's already trivial to do in the base language and has a
> >standard idiom (sizeof x / sizeof *
On 22/09/20 12:25 -0400, Rich Felker wrote:
Is there really a reason to want a nonstandard macro like this to do
something that's already trivial to do in the base language and has a
standard idiom (sizeof x / sizeof *x)?
IMHO no.
On Mon, Sep 21, 2020 at 02:47:51PM +0200, Alejandro Colomar wrote:
> [[ CC += libc-coord at lists.openwall.com ]]
I missed the beginning of this so perhaps it's already been discussed,
but I don't see how cdefs.h is a remotely reasonable place for this.
cdefs.h is included by all glibc headers and
* Ville Voutilainen:
> Why should this be array_length and not __array_length? This is a
> vendor extension, so it should use
> a name that is reserved for such?
In general, we use __ for glibc internals that are not intended for
direct access by users. In some cases, we have non-__ identifiers
Thanks again for your improvements.
I think this might be ready for a patch already.
Any more thoughts?
Thanks,
Alex
#if defined(__cplusplus)
# include
# if __cplusplus >= 201103L
template
constexpr inline std::size_t
__array_length(const _Tp(&)[_Len]) __THROW
{
* Jonathan Wakely:
> I don't see much point in using std::size here. If you're going to
> provide the alternative implementation for when std::size isn't
> defined, why not just use it always?
>
> template
> #if __cplusplus >= 201103L
> constexpr
> #endif
> inline std::size_t
> __array_length(cons
On 22/09/20 11:10 +0200, Alejandro Colomar via Libstdc++ wrote:
[[ CC += LKML ]]
Thanks for all your input. I learned some C++ :)
The following code works for all C and C++ standards:
g++ --std={c++98, c++03, c++11, c++14, c++17, c++20}
gcc --std={c89, c99, c11, c18, c2x}
With `-Wall -Wextra -
* Jonathan Wakely:
>># define array_length(arr) (std:size(arr))
>
> C++ programmers will not accept a macro for this.
I think we need a macro for C++98 support because there is no other way
to produce constant expression.
Note that this intended for C programs compiled in C++ mode. As pointe
[[ CC += LKML ]]
Thanks for all your input. I learned some C++ :)
The following code works for all C and C++ standards:
g++ --std={c++98, c++03, c++11, c++14, c++17, c++20}
gcc --std={c89, c99, c11, c18, c2x}
With `-Wall -Wextra -Werror -pedantic -Wno-vla -Wno-sizeof-pointer-div`.
It doesn't co
On Tue, 22 Sep 2020 at 01:07, Jonathan Wakely via Libstdc++
wrote:
> ># define array_length(arr)(std:size(arr))
>
> C++ programmers will not accept a macro for this.
..in other words, the C++17 version of it needs to be an inline
function that returns std::size of an array,
not a macro. All
On 21/09/20 23:52 +0200, Alejandro Colomar via Libstdc++ wrote:
I have developed this draft code, the C++ part being based on what you
wrote.
I am a C programmer, and my C++ is very basic, and I tend to write
C-compatible code when I need C++, so I can't really write the C++
part.
I tested
I have developed this draft code, the C++ part being based on what you
wrote.
I am a C programmer, and my C++ is very basic, and I tend to write
C-compatible code when I need C++, so I can't really write the C++ part.
I tested the code with all C versions (--std= {c89, c99, c11, c18,
c2x}),
Why would C++ programmers need this given
https://en.cppreference.com/w/cpp/iterator/size ?
On Mon, Sep 21, 2020, 05:54 Alejandro Colomar
wrote:
> [[ CC += libc-coord at lists.openwall.com ]]
>
> On 2020-09-21 12:33, Florian Weimer wrote:
> > * Alejandro Colomar:
> >
> >> [[
> >> CC += libc-coor
On 21/09/20 12:33 +0200, Florian Weimer via Libstdc++ wrote:
* Alejandro Colomar:
[[
CC += libc-co...@sourceware.org
CC += gcc@gcc.gnu.org
CC += libstd...@gcc.gnu.org
]]
Hi Florian,
On 2020-09-21 10:38, Florian Weimer wrote:
* Alejandro Colomar via Libc-alpha:
I'd like to propose exposing
[[ CC += libc-coord at lists.openwall.com ]]
On 2020-09-21 12:33, Florian Weimer wrote:
* Alejandro Colomar:
[[
CC += libc-coord at sourceware.org
CC += gcc at gcc.gnu.org
CC += libstdc++ at gcc.gnu.org
]]
Hi Florian,
On 2020-09-21 10:38, Florian Weimer wrote:
* Alejandro Colomar via Libc-a
* Alejandro Colomar:
> [[
> CC += libc-co...@sourceware.org
> CC += gcc@gcc.gnu.org
> CC += libstd...@gcc.gnu.org
> ]]
>
> Hi Florian,
>
> On 2020-09-21 10:38, Florian Weimer wrote:
>> * Alejandro Colomar via Libc-alpha:
>>
>>> I'd like to propose exposing the macro 'array_length()' as defined in
[[
CC += libc-co...@sourceware.org
CC += gcc@gcc.gnu.org
CC += libstd...@gcc.gnu.org
]]
Hi Florian,
On 2020-09-21 10:38, Florian Weimer wrote:
> * Alejandro Colomar via Libc-alpha:
>
>> I'd like to propose exposing the macro 'array_length()' as defined in
>> 'include/array_length.h' to the user.
18 matches
Mail list logo