Jump to content
  • Advertisement
Sign in to follow this  
lride

warning C4309: 'specialization': truncation of constant value

This topic is 613 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Here, I'm calling uint32_t version of Packer::pack, but I'm getting this warning. 

Could someone help me out? Thanks!

Packer packer;
packer.pack<0, 127>(7u); //no warning
packer.pack<0, 128>(7u); //warning
class Packer
{
public:
Packer();


const void * getData() const;
std::size_t getDataSize() const;
void pack(bool data);

template <std::int8_t min = (std::numeric_limits<std::int8_t>::min)(), std::int8_t max = (std::numeric_limits<std::int8_t>::max)()>
void pack(std::int8_t data);

template <std::uint8_t min = (std::numeric_limits<std::uint8_t>::min)(), std::uint8_t max = (std::numeric_limits<std::uint8_t>::max)()>
void pack(std::uint8_t data);

template <std::int16_t min = (std::numeric_limits<std::int16_t>::min)(), std::int16_t max = (std::numeric_limits<std::int16_t>::max)()>
void pack(std::int16_t data);

template <std::uint16_t min = (std::numeric_limits<std::uint16_t>::min)(), std::uint16_t max = (std::numeric_limits<std::uint16_t>::max)()>
void pack(std::uint16_t data);

template <std::int32_t min = (std::numeric_limits<std::int32_t>::min)(), std::int32_t max = (std::numeric_limits<std::int32_t>::max)()>
void pack(std::int32_t data);

template <std::uint32_t min = (std::numeric_limits<std::uint32_t>::min)(), std::uint32_t max = (std::numeric_limits<std::uint32_t>::max)()>
void pack(std::uint32_t data);

...

 

Share this post


Link to post
Share on other sites
Advertisement

Thanks, that works.

But I don't understand why I don't get a warning with packer.pack<0, 127>(7u)?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!