On Tue, 10 Oct 2017 19:55:36 +, Chirs Forest wrote:
> It wouldn't be so bad if I didn't have to use the word cast before each
> cast, bust since I have to specify both the word cast and the cast type
> and then wrap both the cast type and the value in brackets... it just
> explodes my code
On Friday, 25 November 2016 at 19:16:43 UTC, ketmar wrote:
yeah. but i'm not Andrei, i don't believe that the only
compiler task is to resolve templated code. ;-) i.e. Andrei
believes that everything (and more) should be moved out of
compiler core and done with library templates. Andrei is
On Tuesday, 10 October 2017 at 22:00:27 UTC, kinke wrote:
[...]
Ah sorry, overlooked that it's the initializer for a struct field.
On Tuesday, 10 October 2017 at 14:15:07 UTC, Simon Bürger wrote:
On Tuesday, 10 October 2017 at 13:48:16 UTC, Andrea Fontana
wrote:
Maybe:
double[n] bar = 0.repeat(n).array;
This works fine, thanks a lot. I would have expected `.array`
to return a dynamic array. But apparently the compiler
On Tuesday, 10 October 2017 at 19:55:36 UTC, Chirs Forest wrote:
Why?
D inherited a silly rule from C where any arithmetic is promoted
to int first.
The big difference is D doesn't do implicit narrowing
conversion... so x + 1 becomes int, but then int to byte requires
an explicit cast
On 10/10/2017 04:30 AM, drug wrote:
> using classes I can make an inherited class of templated class and avoid
> too long mangled name:
> ```
> class TemplatedClass(A, Very, Much, Args, Here) { ... }
>
> class ShortenClass : TemplatedClass!(A,Very, Much, Args, Here) { ... };
> ```
> Now
On Tuesday, 10 October 2017 at 19:55:36 UTC, Chirs Forest wrote:
I keep having to make casts like the following and it's really
rubbing me the wrong way:
void foo(T)(T bar){...}
byte bar = 9;
[...]
Why?
Because of integer promotion [1], which is inherited from C.
[1]
On Tuesday, 10 October 2017 at 19:55:36 UTC, Chirs Forest wrote:
I keep having to make casts like the following and it's really
rubbing me the wrong way:
void foo(T)(T bar){...}
byte bar = 9;
foo!byte(bar + 1); //Error: function foo!byte.foo (byte bar) is
not callable using argument types
I keep having to make casts like the following and it's really
rubbing me the wrong way:
void foo(T)(T bar){...}
byte bar = 9;
foo!byte(bar + 1); //Error: function foo!byte.foo (byte bar) is
not callable using argument types (int)
foo!byte(cast(byte)(bar + 1));
It wouldn't be so bad if I
Why isn't there an array/range version of `emplace`, when there
is one for `moveEmplace`, namely
https://dlang.org/library/std/algorithm/mutation/move_emplace_all.html
?
On 10/10/2017 03:36 PM, Simon Bürger wrote:
I have a static array inside a struct which I would like to be
initialized to all-zero like so
struct Foo(size_t n)
{
double[n] bar = ... all zeroes ...
}
(note that the default-initializer of double is nan, and not zero)
I tried
On 10/10/17 11:09 AM, MrSmith wrote:
I have a static library and an application.
When linking final executable I get:
lib.lib(texteditor_1d_40c.obj) : error LNK2001: unresolved external
symbol internal
lib.lib(textbuffer_14_3ce.obj) : error LNK2001: unresolved external
symbol
https://run.dlang.io/is/SC3Fks
I have a static library and an application.
When linking final executable I get:
lib.lib(texteditor_1d_40c.obj) : error LNK2001: unresolved
external symbol internal
lib.lib(textbuffer_14_3ce.obj) : error LNK2001: unresolved
external symbol internal
Happens on Windows 32 and 64 bit.
Yeah, you are right. My fault.
On Tue, Oct 10, 2017 at 4:47 PM, Adam D. Ruppe via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> On Tuesday, 10 October 2017 at 14:42:15 UTC, Daniel Kozak wrote:
>
>> It will return dynamic array. it is same as:
>>
>> double[5] = [0,0,0,0,0]; //
On Tuesday, 10 October 2017 at 14:42:15 UTC, Daniel Kozak wrote:
It will return dynamic array. it is same as:
double[5] = [0,0,0,0,0]; // this is still dynamicaly allocated.
Not true here, the compiler knows it is going into a static array
and puts the result directly in there. It handles
On Tue, Oct 10, 2017 at 4:15 PM, Simon Bürger via Digitalmars-d-learn <
digitalmars-d-learn@puremagic.com> wrote:
> On Tuesday, 10 October 2017 at 13:48:16 UTC, Andrea Fontana wrote:
>
>> On Tuesday, 10 October 2017 at 13:36:56 UTC, Simon Bürger wrote:
>>
>>> Is there a good way to set them all
On Tuesday, 10 October 2017 at 13:54:16 UTC, Daniel Kozak wrote:
struct Double
{
double v = 0;
alias v this;
}
struct Foo(size_t n)
{
Double[n] bar;
}
Interesting approach. But this might introduce problems later.
For example `Double` is implicitly convertible to `double`, but
On Tuesday, 10 October 2017 at 13:48:16 UTC, Andrea Fontana wrote:
On Tuesday, 10 October 2017 at 13:36:56 UTC, Simon Bürger wrote:
Is there a good way to set them all to zero? The only way I
can think of is using string-mixins to generate a string such
as "[0,0,0,0]" with exactly n zeroes.
On Tuesday, 10 October 2017 at 13:53:37 UTC, jmh530 wrote:
double[n] bar;
bar[] = 0;
This works at runtime only for mutable arrays, anyway.
On Tuesday, 10 October 2017 at 13:48:16 UTC, Andrea Fontana wrote:
Maybe:
double[n] bar = 0.repeat(n).array;
Alt:
double[n] bar;
bar[] = 0;
struct Double
{
double v = 0;
alias v this;
}
struct Foo(size_t n)
{
Double[n] bar;
}
Dne 10. 10. 2017 3:40 odpoledne napsal uživatel "Simon Bürger via
Digitalmars-d-learn" :
I have a static array inside a struct which I would like to be
On Tuesday, 10 October 2017 at 13:36:56 UTC, Simon Bürger wrote:
Is there a good way to set them all to zero? The only way I can
think of is using string-mixins to generate a string such as
"[0,0,0,0]" with exactly n zeroes. But that seems quite an
overkill for such a basic task. I suspect I
Use alias this
Dne 10. 10. 2017 1:30 odpoledne napsal uživatel "drug via
Digitalmars-d-learn" :
> using classes I can make an inherited class of templated class and avoid
> too long mangled name:
> ```
> class TemplatedClass(A, Very, Much, Args, Here) { ... }
>
I have a static array inside a struct which I would like to be
initialized to all-zero like so
struct Foo(size_t n)
{
double[n] bar = ... all zeroes ...
}
(note that the default-initializer of double is nan, and not zero)
I tried
double[n] bar = 0; // does not compile
using classes I can make an inherited class of templated class and avoid
too long mangled name:
```
class TemplatedClass(A, Very, Much, Args, Here) { ... }
class ShortenClass : TemplatedClass!(A,Very, Much, Args, Here) { ... };
```
Now ShortenClass has a nice mangling.
What can be done in case
On Tuesday, 12 September 2017 at 04:33:30 UTC, Nicholas Wilson
wrote:
On Tuesday, 12 September 2017 at 03:51:45 UTC, Laeeth Isharc
wrote:
Hi.
I'm here in HK with Ilya, Atila, John Colvin, and Jonathan
Davis.
I wondered what the current state of D catching C++
exceptions was on Linux and
On Tuesday, 10 October 2017 at 02:58:45 UTC, Mr. Jonse wrote:
I need to store a hetrogeneous array of delegates. How can I do
this but still call the function with the appropriate number of
parameters at run time?
I have the parameters as Variant[] params and a
function/delegate
On Tuesday, 10 October 2017 at 02:58:45 UTC, Mr. Jonse wrote:
I need to store a hetrogeneous array of delegates. How can I do
this but still call the function with the appropriate number of
parameters at run time?
I have the parameters as Variant[] params and a
function/delegate
On Monday, 9 October 2017 at 15:22:54 UTC, Adam D. Ruppe wrote:
On Monday, 9 October 2017 at 15:15:48 UTC, Zhuo Nengwen wrote:
test(cast(ushort) 1, (m, c) => {
writeln(m);
writeln(m);
});
Just remove the =>
(m, c) {
// code here
}
Common mistake from people who worked with LINQ in
30 matches
Mail list logo