November 16, 2012
On Friday, November 16, 2012 08:26:10 Jacob Carlborg wrote:
> On 2012-11-15 22:08, Joseph Rushton Wakeling wrote:
> > Complete misunderstanding there -- I'd interpreted Simen's remark as saying that e.g. auto x = 1; would automatically assign the correct type where builtins were concerned, and I was pointing out that this wouldn't cover all builtins.  Though I guess auto x = 1UL; would work.
> 
> Should this give you an unsigned long regardless of architecture? "size_t" is unsigned int on 32bit platforms and unsigned long on 64bit platforms.

Yeah. If you want a literal to be size_t, then you either need to assign it to a variable of type size_t or cast it. L means long and UL means unsigned long, whereas size_t varies from architecture to architecture.

- Jonathan M Davis
November 17, 2012
size_t i = to!size_t(1) << m;
1 2 3 4
Next ›   Last »