On Monday, 20 August 2018 at 08:34:56 UTC, Andrey wrote:
Hello,
Here is a code that you can execute using online compiler
https://run.dlang.io/:
import std.stdio;
void main()
{
ushort first = 5;
ushort second = 1000;
ushort result = first + second;
writeln(result);
}
I hae thi
On Monday, August 20, 2018 4:29:56 AM MDT Andrey via Digitalmars-d-learn
wrote:
> On Monday, 20 August 2018 at 09:56:13 UTC, Jonathan M Davis wrote:
> > It's a combination of keeping the C semantics (in general, C
> > code is valid D code with the same semantics, or it won't
> > compile) and the f
On Monday, 20 August 2018 at 09:56:13 UTC, Jonathan M Davis wrote:
It's a combination of keeping the C semantics (in general, C
code is valid D code with the same semantics, or it won't
compile) and the fact that D requires casts for narrowing
conversions. When you add two shorts in C/C++, it c
On Monday, August 20, 2018 3:19:04 AM MDT Andrey via Digitalmars-d-learn
wrote:
> On Monday, 20 August 2018 at 08:49:00 UTC, rikki cattermole wrote:
> > Yes. On x86 int's will be faster just an FYI so it does make
> > sense to use them for computation.
>
> Inconveniently always use casts. Why in D
On 20/08/2018 9:19 PM, Andrey wrote:
On Monday, 20 August 2018 at 08:49:00 UTC, rikki cattermole wrote:
Yes. On x86 int's will be faster just an FYI so it does make sense to
use them for computation.
Inconveniently always use casts. Why in D one decided to do in such way?
C.
On Monday, 20 August 2018 at 08:49:00 UTC, rikki cattermole wrote:
Yes. On x86 int's will be faster just an FYI so it does make
sense to use them for computation.
Inconveniently always use casts. Why in D one decided to do in
such way?
On 20/08/2018 8:48 PM, Andrey wrote:
On Monday, 20 August 2018 at 08:42:20 UTC, rikki cattermole wrote:
It's called integer promotion and it originates from C.
And yes C++ does have such support in some variant (I really don't
feel like comparing the two).
And I should do? Always use "cast" o
On Monday, 20 August 2018 at 08:42:20 UTC, rikki cattermole wrote:
It's called integer promotion and it originates from C.
And yes C++ does have such support in some variant (I really
don't feel like comparing the two).
And I should do? Always use "cast" operator when I operate not
with ints?
On 20/08/2018 8:34 PM, Andrey wrote:
Hello,
Here is a code that you can execute using online compiler
https://run.dlang.io/:
import std.stdio;
void main()
{
ushort first = 5;
ushort second = 1000;
ushort result = first + second;
writeln(result);
}
I hae this error:
onlineapp.d
Hello,
Here is a code that you can execute using online compiler
https://run.dlang.io/:
import std.stdio;
void main()
{
ushort first = 5;
ushort second = 1000;
ushort result = first + second;
writeln(result);
}
I hae this error:
onlineapp.d(7): Error: cannot implicitly convert
10 matches
Mail list logo