can anybody tell me why
struct S
{
int x;
alias x this;
}
void test()
{
S s;
s = 8; // this works
S s = 8 // but this does not?
}
Hi, I have a simple program with just one line (below). I've
compiled on Windows using
dmd -ms32coff app.d
and have had LINKCMD set to lld-link, but get the following
errors. Is lld-link only for 64-bit compiles (-m64 is the only
one that gives no errors)
lld-link: error: /safeseh: app.obj i
On 5/24/20 2:37 AM, Pavel Shkadzko wrote:
On Saturday, 23 May 2020 at 19:59:30 UTC, Ali Çehreli wrote:
On 5/23/20 11:15 AM, Pavel Shkadzko wrote:> I have tried to implement
a simple flatten function for multidimensional
[...]
Thank you, I was lacking practical examples for templates with "if
On Sunday, 24 May 2020 at 21:43:34 UTC, H. S. Teoh wrote:
On Sun, May 24, 2020 at 09:34:53PM +, jmh530 via
Digitalmars-d-learn wrote:
The following code results in the static assert in the
constructor being triggered, even though I would have thought
no constructor would have been called. I
On Sunday, 24 May 2020 at 21:34:53 UTC, jmh530 wrote:
The following code results in the static assert in the
constructor being triggered, even though I would have thought
no constructor would have been called.
static assert is triggered when the code is *compiled*, whether
it is actually run
On Sun, May 24, 2020 at 09:34:53PM +, jmh530 via Digitalmars-d-learn wrote:
> The following code results in the static assert in the constructor
> being triggered, even though I would have thought no constructor would
> have been called. I know that there is an easy fix for this (move the
> sta
The following code results in the static assert in the
constructor being triggered, even though I would have thought no
constructor would have been called. I know that there is an easy
fix for this (move the static if outside the constructor), but it
still seems like it doesn't make sense.
en
"doesn't work" isn't very helpful. Are you seeing compiler
errors? Linker errors? Runtime errors? Please describe your
problem.
Solved my problem alone : wrong signatures with functions ;)
and this reply isn't very helpful.
what is right signature?
you go to forum to ask help.
but wish you he
On Saturday, 23 May 2020 at 01:33:13 UTC, Mike Parker wrote:
On Friday, 22 May 2020 at 19:19:19 UTC, Arsium wrote:
Just I tried to launch those functions from win32 api and
seems doesn't work
"doesn't work" isn't very helpful. Are you seeing compiler
errors? Linker errors? Runtime errors? P
On Sunday, 24 May 2020 at 15:24:14 UTC, 9il wrote:
On Sunday, 24 May 2020 at 14:17:33 UTC, Pavel Shkadzko wrote:
[...]
BTW, the code example above doesn't compiles.
OT:
Instead of
[...]
you can generate the same common D array using Mir:
auto a = [2, 2, 4].iota!int(1).ndarray;
On Sunday, 24 May 2020 at 17:05:16 UTC, Vinod K Chandran wrote:
Hi all,
I have a class like this.
class Button : Control {
...
HWND createButton(){
...
SetWindowSubclass(this.mHandle, SUBCLASSPROC(&btnWndProc),
UINT_PTR(subClsID), cast(DWORD_PTR) this);
On 24.05.20 19:13, data pulverizer wrote:
Thank you very much. I though that if I used a `static foreach` loop D
would attempt to run the calculation `bench()` at compile time rather
than at run time but it doesn't which is good. So `static foreach`
allows you to index at compile time and if it
On Sunday, 24 May 2020 at 17:13:23 UTC, data pulverizer wrote:
On Sunday, 24 May 2020 at 16:57:54 UTC, ag0aep6g wrote:
On 24.05.20 18:34, data pulverizer wrote:
Since `kernel` is a `Tuple`, you can only access it with
compile-time constant indices.
But your loop variable `i` is not a compile-
On Sunday, 24 May 2020 at 16:57:54 UTC, ag0aep6g wrote:
On 24.05.20 18:34, data pulverizer wrote:
Since `kernel` is a `Tuple`, you can only access it with
compile-time constant indices.
But your loop variable `i` is not a compile-time constant, it's
being calculated at run time. What's more,
Hi all,
I have a class like this.
class Button : Control {
...
HWND createButton(){
...
SetWindowSubclass(this.mHandle, SUBCLASSPROC(&btnWndProc),
UINT_PTR(subClsID), cast(DWORD_PTR) this);
}
}
But compiler says that - "Error: 'this' is not an lvalue an
On 24.05.20 18:34, data pulverizer wrote:
I'm getting the error:
```
Error: variable i cannot be read at compile time
Error: template instance
script.runKernelBenchmarks!(Tuple!(DotProduct!float, Gaussian!float,
Polynomial!float, Exponential!float, Log!float, Cauchy!float,
Power!float, Wave!f
Hi all,
I'm getting the error:
```
Error: variable i cannot be read at compile time
Error: template instance
script.runKernelBenchmarks!(Tuple!(DotProduct!float,
Gaussian!float, Polynomial!float, Exponential!float, Log!float,
Cauchy!float, Power!float, Wave!float, Sigmoid!float)) error
insta
On Sunday, 24 May 2020 at 16:14:58 UTC, Russel Winder wrote:
On Sun, 2020-05-24 at 17:01 +0100, Russel Winder wrote:
[…]
connection.read(buffer, IOMode.once);
What an idiot I am, this call returns the read count, which
makes it fine.
Progress now being made.
I had a look. Documentation
On Sun, 2020-05-24 at 17:01 +0100, Russel Winder wrote:
>
[…]
> connection.read(buffer, IOMode.once);
>
What an idiot I am, this call returns the read count, which makes it fine.
Progress now being made.
--
Russel.
===
Dr Russel Winder t: +44 20 758
On Sun, 2020-05-24 at 12:26 +, bauss via Digitalmars-d-learn wrote:
[…]
Thanks for responding, much appreciated.
> void handleConnections(TCPConnection connection) {
> ...
> }
I guess I was looking for an example of what to put in this function!
> auto buf = new ubyte[amount];
>
> conn
On Sunday, 24 May 2020 at 14:17:33 UTC, Pavel Shkadzko wrote:
I am confused by the return value of Mir shape.
Consider the following example.
///
import std.stdio;
import std.conv;
import std.array: array;
import std.range:
On Sunday, 24 May 2020 at 14:35:33 UTC, jmh530 wrote:
On Sunday, 24 May 2020 at 14:21:26 UTC, Pavel Shkadzko wrote:
[snip]
Sorry for the typo. It should be "auto arrSlice = a.sliced;"
Try using fuse
/+dub.sdl:
dependency "mir-algorithm" version="*"
+/
import std.stdio;
import std.conv;
impor
On Sunday, 24 May 2020 at 14:17:33 UTC, Pavel Shkadzko wrote:
I am confused by the return value of Mir shape.
Consider the following example.
[...]
`sliced` returns a view on the array data, a 1-dimensional slice
composed of common D arrays. Try to use `fuse` instead of
`sliced`.
On Sunday, 24 May 2020 at 14:21:26 UTC, Pavel Shkadzko wrote:
On Sunday, 24 May 2020 at 14:17:33 UTC, Pavel Shkadzko wrote:
I am confused by the return value of Mir shape.
Consider the following example.
[...]
Sorry for the typo. It should be "auto arrSlice = a.sliced;"
And another typo "wr
On Sunday, 24 May 2020 at 14:21:26 UTC, Pavel Shkadzko wrote:
[snip]
Sorry for the typo. It should be "auto arrSlice = a.sliced;"
Try using fuse
/+dub.sdl:
dependency "mir-algorithm" version="*"
+/
import std.stdio;
import std.conv;
import std.array: array;
import std.range: chunks;
import mi
On Sunday, 24 May 2020 at 14:17:33 UTC, Pavel Shkadzko wrote:
I am confused by the return value of Mir shape.
Consider the following example.
[...]
Sorry for the typo. It should be "auto arrSlice = a.sliced;"
I am confused by the return value of Mir shape.
Consider the following example.
///
import std.stdio;
import std.conv;
import std.array: array;
import std.range: chunks;
import mir.ndslice;
int[] getShape(T : int)(T obj, int
On 24.05.20 14:29, bauss wrote:
Dang, that sucks there is no proper way and I would say that's a big
flaw of D.
Because what I need it for is for some data serialization but if the
value is an empty array then it should be present and if it's null then
it should not be present.
Since null i
On 24.05.20 14:12, bauss wrote:
Is there a way to do that?
Since the following are both true:
int[] a = null;
int[] b = [];
assert(a is null);
assert(!a.length);
assert(b is null);
assert(!b.length);
What I would like is to tell that b is an empty array and a is a null
array.
No way. `nul
On Sunday, May 24, 2020 6:12:31 AM MDT bauss via Digitalmars-d-learn wrote:
> Is there a way to do that?
>
> Since the following are both true:
>
> int[] a = null;
> int[] b = [];
>
> assert(a is null);
> assert(!a.length);
>
> assert(b is null);
> assert(!b.length);
>
> What I would like is to tel
On Sunday, 24 May 2020 at 08:10:33 UTC, Russel Winder wrote:
Hi,
Clearly Vibe.d is mostly for people doing HTTP and HTTPS stuff.
Yet it claims to be able to support TCP and UDP working with
other protocols. However, all the serious examples are
HTTP/HTTPS related. All the TCP and UDP examples
On Sunday, 24 May 2020 at 12:26:42 UTC, ag0aep6g wrote:
On 24.05.20 14:12, bauss wrote:
Is there a way to do that?
Since the following are both true:
int[] a = null;
int[] b = [];
assert(a is null);
assert(!a.length);
assert(b is null);
assert(!b.length);
What I would like is to tell that b
On Sunday, May 24, 2020 2:57:28 AM MDT Luis via Digitalmars-d-learn wrote:
> Lets take this example code (https://run.dlang.io/is/Vkpx9j) :
>
> ´´´D
> import std;
>
> void main()
> {
> }
>
> class ExampleC
> {
>int x;
>this (int x) @safe
>{
> this.x = x;
>}
>
>override bool
On Sunday, 24 May 2020 at 12:12:31 UTC, bauss wrote:
Is there a way to do that?
Since the following are both true:
int[] a = null;
int[] b = [];
assert(a is null);
assert(!a.length);
assert(b is null);
assert(!b.length);
What I would like is to tell that b is an empty array and a is
a null
Is there a way to do that?
Since the following are both true:
int[] a = null;
int[] b = [];
assert(a is null);
assert(!a.length);
assert(b is null);
assert(!b.length);
What I would like is to tell that b is an empty array and a is a
null array.
On Sunday, 24 May 2020 at 11:21:00 UTC, 9il wrote:
On Saturday, 23 May 2020 at 18:15:32 UTC, Pavel Shkadzko wrote:
[...]
If the common nd-array isn't jugged (a parallelotop), you can
use fuse function.
--
/+dub.sdl:
dependency "mir-algorithm" version="~>3.8.12"
+/
import std.stdio:
On Saturday, 23 May 2020 at 18:15:32 UTC, Pavel Shkadzko wrote:
I have tried to implement a simple flatten function for
multidimensional arrays with recursive templates but got stuck.
Then I googled a little and stumped into complex
https://rosettacode.org/wiki/Flatten_a_list#D implementation
On Sunday, 24 May 2020 at 08:57:28 UTC, Luis wrote:
dmd ignores @trusted or @safe on opEquals, throwing this error :
onlineapp.d(27): Error: @safe function
onlineapp.__unittest_L24_C7 cannot call @system function
object.opEquals
An override @system or @trusted function can't be @safe, or I
On Saturday, 23 May 2020 at 19:59:30 UTC, Ali Çehreli wrote:
On 5/23/20 11:15 AM, Pavel Shkadzko wrote:> I have tried to
implement a simple flatten function for multidimensional
[...]
Thank you, I was lacking practical examples for templates with
"if" constructs, ehh.
Lets take this example code (https://run.dlang.io/is/Vkpx9j) :
´´´D
import std;
void main()
{
}
class ExampleC
{
int x;
this (int x) @safe
{
this.x = x;
}
override bool opEquals(Object o) const @trusted
{
if (ExampleC rhs = cast(ExampleC)o) {
return this.x == rhs.x;
Hi,
Clearly Vibe.d is mostly for people doing HTTP and HTTPS stuff. Yet it claims
to be able to support TCP and UDP working with other protocols. However, all
the serious examples are HTTP/HTTPS related. All the TCP and UDP examples are
basically trivial and thus useless to me for learning.
I am
On Sat, 2020-05-23 at 20:52 +, Steven Schveighoffer via Digitalmars-d-
learn wrote:
[…]
>
> It’s a recent problem with vibe-core. I’ve had to switch back to
> version 1.8.1.
>
> https://github.com/vibe-d/vibe-core/issues/205
Really good to know this is a genuine problem and not just me doin
On Sunday, May 24, 2020 12:38:46 AM MDT Tim via Digitalmars-d-learn wrote:
> Oh right. I mean it makes sense but I got confused when super()
> is valid syntax. Why would you need to call the super constructor
> when it's called automatically?
1. If you wanted to run any code before calling the bas
On Sunday, 24 May 2020 at 06:38:46 UTC, Tim wrote:
Oh right. I mean it makes sense but I got confused when super()
is valid syntax. Why would you need to call the super
constructor when it's called automatically?
A base class with a constructor that has no args will
automatically get called a
44 matches
Mail list logo