On Thursday, 5 November 2015 at 09:33:40 UTC, ixid wrote:
In C++ I can add two shorts together without having to use a
cast to assign the result to one of the two shorts. It just
seems super clunky not to be able to do basic operations on
basic types without casts everywhere.
+1
If
On Thursday, 5 November 2015 at 05:41:46 UTC, Jonathan M Davis
wrote:
On Wednesday, November 04, 2015 21:22:02 ixid via
Digitalmars-d-learn wrote:
On Wednesday, 4 November 2015 at 19:09:42 UTC, Maxim Fomin
wrote:
> On Wednesday, 4 November 2015 at 14:27:49 UTC, ixid wrote:
>> Is there an
And I want to have small number litterals automatically choosing
the smallest fitting type.
If I write
ubyte b = 1u;
auto c = b + 1u;
I expect the 1u to be of type ubyte - and also c.
On Thursday, 5 November 2015 at 13:23:34 UTC, Adam D. Ruppe wrote:
On Thursday, 5 November 2015 at 10:07:30 UTC, Dominikus Dittes
Scherkl wrote:
ubyte b = 1u;
auto c = b + 1u;
I expect the 1u to be of type ubyte - and also c.
This won't work because of the one-expression rule. In the
On Thursday, 5 November 2015 at 22:15:46 UTC, Dominikus Dittes
Scherkl wrote:
On Thursday, 5 November 2015 at 13:23:34 UTC, Adam D. Ruppe
wrote:
On Thursday, 5 November 2015 at 10:07:30 UTC, Dominikus Dittes
Scherkl wrote:
ubyte d = b + (ubyte)1;
Sorry, should of course be:
ubyte d = b +
On Thursday, November 05, 2015 09:33:39 ixid via Digitalmars-d-learn wrote:
> In C++ I can add two shorts together without having to use a cast
> to assign the result to one of the two shorts. It just seems
> super clunky not to be able to do basic operations on basic types
> without casts
On Thursday, 5 November 2015 at 10:07:30 UTC, Dominikus Dittes
Scherkl wrote:
And I want to have small number litterals automatically
choosing the smallest fitting type.
It does, that's the value range propagation at work. Inside one
expression, if the compiler can prove it fits in a smaller
On Wednesday, 4 November 2015 at 19:09:42 UTC, Maxim Fomin wrote:
On Wednesday, 4 November 2015 at 14:27:49 UTC, ixid wrote:
Is there an elegant way of avoiding implicit conversion to int
when you're using shorter types?
Only with library solution. Implicit conversions are built into
On Wednesday, 4 November 2015 at 21:22:04 UTC, ixid wrote:
On Wednesday, 4 November 2015 at 19:09:42 UTC, Maxim Fomin
wrote:
On Wednesday, 4 November 2015 at 14:27:49 UTC, ixid wrote:
Is there an elegant way of avoiding implicit conversion to
int when you're using shorter types?
Only with
On Wednesday, November 04, 2015 21:22:02 ixid via Digitalmars-d-learn wrote:
> On Wednesday, 4 November 2015 at 19:09:42 UTC, Maxim Fomin wrote:
> > On Wednesday, 4 November 2015 at 14:27:49 UTC, ixid wrote:
> >> Is there an elegant way of avoiding implicit conversion to int
> >> when you're using
On Wednesday, 4 November 2015 at 14:27:49 UTC, ixid wrote:
Is there an elegant way of avoiding implicit conversion to int
when you're using shorter types?
Only with library solution. Implicit conversions are built into
language.
On Wednesday, 4 November 2015 at 14:27:49 UTC, ixid wrote:
Is there an elegant way of avoiding implicit conversion to int
when you're using shorter types?
Also does this not seem inconsistent:
ushort a = ushort.max, b = ushort.max;
a += b; // Compiles fine
a = a + b; // Error:
Is there an elegant way of avoiding implicit conversion to int
when you're using shorter types?
V Wed, 04 Nov 2015 14:27:45 +
ixid via Digitalmars-d-learn
napsáno:
> Is there an elegant way of avoiding implicit conversion to int
> when you're using shorter types?
http://dlang.org/phobos/std_typecons.html#.Typedef
On Wednesday, 4 November 2015 at 17:26:04 UTC, Daniel Kozak wrote:
V Wed, 04 Nov 2015 14:27:45 +
ixid via Digitalmars-d-learn
napsáno:
Is there an elegant way of avoiding implicit conversion to int
when you're using shorter types?
15 matches
Mail list logo