Hey Jeff, Looks good by itself, but I'm not sure about putting it in config.h, as it isn't a config option. I'd rather put it in misc.h, as IIRC all of our tools (like rotate and other stuff) live there.
If it needs to be in config.h, for some very good reason it's ok, but rather put it in the place where it's supposed to be. BR JPM Am 03.07.2015 um 06:49 schrieb Jeffrey Walton: > I'd like to get the following checked in to add some type safety to > places where sizeof(x)/sizeof(x[0]) is used. > > On Microsoft platforms, the type checks will be in-force. Other > platforms will enjoy the diagnostics from the Windows platform. > > I am going to resist expanding it to other platforms (similar to > http://stackoverflow.com/q/9679097). Its hard to test some of the > older platforms, so I'm not sure if the cleverness is worth > potentially breaking a compile. > > Any comments or objections? > > ********** > > $ git diff config.h > diff --git a/config.h b/config.h > index d853b33..1667598 100644 > --- a/config.h > +++ b/config.h > @@ -96,6 +96,12 @@ typedef unsigned char byte; // put in > global namespa > > #define CRYPTOPP_UNUSED(x) ((void)x) // cast to void. > Portable way to > > +#if defined(_MSC_VER) && (_MSC_VER >= 1400) // VS2005 > added _countof > +# defined COUNTOF(x) _countof(x) > +#else > +# define COUNTOF(x) (sizeof(x)/sizeof(x[0])) > +#endif > + > NAMESPACE_BEGIN(CryptoPP) > > -- > -- > You received this message because you are subscribed to the "Crypto++ > Users" Google Group. > To unsubscribe, send an email to > cryptopp-users-unsubscr...@googlegroups.com. > More information about Crypto++ and this group is available at > http://www.cryptopp.com. > --- > You received this message because you are subscribed to the Google > Groups "Crypto++ Users" group. > To unsubscribe from this group and stop receiving emails from it, send > an email to cryptopp-users+unsubscr...@googlegroups.com > <mailto:cryptopp-users+unsubscr...@googlegroups.com>. > For more options, visit https://groups.google.com/d/optout. -- -- You received this message because you are subscribed to the "Crypto++ Users" Google Group. To unsubscribe, send an email to cryptopp-users-unsubscr...@googlegroups.com. More information about Crypto++ and this group is available at http://www.cryptopp.com. --- You received this message because you are subscribed to the Google Groups "Crypto++ Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to cryptopp-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
smime.p7s
Description: S/MIME Cryptographic Signature