|
Boost Users : |
Subject: Re: [Boost-users] [Threads] How to keep number of running thread constant, performing different operations
From: Lars Viklund (zao_at_[hidden])
Date: 2011-09-01 12:43:25
On Thu, Sep 01, 2011 at 04:33:12PM +0400, niXman wrote:
> "unsigned short int i;" - is 16bit variable.
> see here: http://liveworkspace.org/code/b88123920e184955e61aee9cc0c217c6
>
> i.e. in your code variable "i" is overflowed.
I object to this statement. unsigned short is not necessarily 16-bit.
It's inbetween char and int in size, possibly the same as either of
them.
Citing any implementation as a source of definitive sizes is flawed.
On his particular platform, it seems to be 16 bits in size, but it sure
doesn't hold in general.
If you want a 16-bit unsigned integral type, use uint16_t from <cstdint>
or <boost/cstdint.hpp>.
-- Lars Viklund | zao_at_[hidden]
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net