This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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: V3 PATCH: numeric_limits<> support, fix PR/3865


On Sun, Sep 01, 2002 at 11:58:05PM +0200, Gabriel Dos Reis wrote:
> How do you define numeric_limits<wchar_t>::digits10 ?

  // Using the fact that 8,16,32 are the same wrt digits10; could put
  // the signed/unsigned check as another ?: at the beginning.  Also
  // no reason not to use this scheme for all the other integral type
  // definitions and remove some of the other ifdeffing at the same time.

  #define digits10_for_int_type(TYPE)				\
    (sizeof (TYPE) * __CHAR_BIT__ == 8 ? 2			\
     : sizeof (TYPE) * __CHAR_BIT__ == 16 ? 4			\
     : sizeof (TYPE) * __CHAR_BIT__ == 32 ? 9			\
     : sizeof (TYPE) * __CHAR_BIT__ == 64 ? 18 + ((TYPE)-1 > 0)	\
     : /* error */ 0)

  static const int digits10 = digits10_for_int_type (wchar_t);
  


r~


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