Re: Safer determination of static array size

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/09/2013 02:49 PM, Marcin Sobieszczanski wrote:
What about a template function:

template<typename T, size_t SZ> size_t ARRAY_SIZE( T (&a) [SZ] ) {
return SZ; }

Yes, that's a good approach for C++ code, but a lot of code I'm dealing with only compiles as C.

--
Florian Weimer / Red Hat Product Security Team




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux