Should I re-build my toolbox libs after upgrading VS tools under windows?

2023-11-23 Thread Peter Hu via Digitalmars-d-learn
At present my dmd toolsets are DMD2.103+Visual Stiduo 2015 Community+ a lot of libraries built by them and I prefer building 64 bit apps under Win10 64. For some reason,I am planning to upgrade VS2015 community to VS2017+,or even VS2022.If I do so,should all those already built libaries have

Re: interface opEquals

2023-11-23 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, November 23, 2023 2:20:25 PM MST Antonio via Digitalmars-d-learn wrote: > * Why, when applied to interface, ```opEquals``` called directly > behavior is not the same that when calling ```==``` ? > > * Is it the expected behaviour? I'd have to take the time to study your code in

Re: Doubt about type Inference on templates

2023-11-23 Thread Antonio via Digitalmars-d-learn
On Wednesday, 22 November 2023 at 19:37:58 UTC, Paul Backus wrote: This is a bug/limitation in the compiler. I couldn't find an existing report on issues.dlang.org, so I've reported it myself as [issue 24255][1]. Wow: It is a very concise bug example. I tested with ```ldc``` ant it fails

interface opEquals

2023-11-23 Thread Antonio via Digitalmars-d-learn
```d interface IOpt(T) { T value(); bool empty(); bool opEquals(IOpt!T other); } class None(T) : IOpt!T { bool empty() => true; T value(){ throw new Exception("None has not a value"); } bool opEquals(IOpt!T other)=>other.empty; } class Some(T) : IOpt!T { this(T value) {

Re: D: Declaring empty pointer variables that return address inside function calls?

2023-11-23 Thread Julian Fondren via Digitalmars-d-learn
On Thursday, 23 November 2023 at 20:13:59 UTC, BoQsc wrote: Nothing wrong. It would be just a more concise compact way to do the same. Also I mostly wanted to know if something like that is already possible in D language. It's not a huge loss if it is not possible. This is possible in Go:

Re: D: Declaring empty pointer variables that return address inside function calls?

2023-11-23 Thread BoQsc via Digitalmars-d-learn
On Thursday, 23 November 2023 at 20:00:31 UTC, H. S. Teoh wrote: On Thu, Nov 23, 2023 at 07:22:22PM +, BoQsc via Digitalmars-d-learn wrote: Is it possible to declare empty pointer variable inside function calls and pass its address to the function? These are sometimes required while using

Re: mixin under -betterC

2023-11-23 Thread DLearner via Digitalmars-d-learn
On Thursday, 23 November 2023 at 18:54:09 UTC, Julian Fondren wrote: [...] The `enum` answer? [...] No, the 'template' answer. To me, if the 'template' suggestion worked (as it did), then my simple mixin (as in my original post) should also work.

Re: D: Declaring empty pointer variables that return address inside function calls?

2023-11-23 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Nov 23, 2023 at 07:22:22PM +, BoQsc via Digitalmars-d-learn wrote: > Is it possible to declare empty pointer variable inside function calls > and pass its address to the function? > > These are sometimes required while using Win32 - Windows Operating > System API. > > * Empty pointer

Re: comparing with c strings

2023-11-23 Thread Jonathan M Davis via Digitalmars-d-learn
On Thursday, November 23, 2023 11:29:09 AM MST denis via Digitalmars-d-learn wrote: > Let's say I have a D application, with some callbacks from C, > where some arguments to the callbacks are `const char* path`. > What is the recommended way to compare them to D strings? Without > making

D: Declaring empty pointer variables that return address inside function calls?

2023-11-23 Thread BoQsc via Digitalmars-d-learn
Is it possible to declare empty pointer variable inside function calls and pass its address to the function? These are sometimes required while using Win32 - Windows Operating System API. * Empty pointer variables are used by functions to return information after the function is done. My

interface inference

2023-11-23 Thread Antonio via Digitalmars-d-learn
```d interface I { bool check(); } class A : I { bool check() =>true; } class B : I { bool check() =>false; } I aOrB(bool check) => check ? new A() : new B(); void main() { assert( aOrB(true).check ); } ``` Compiler error: ```d x.d(11): Error: cannot implicitly

Re: mixin under -betterC

2023-11-23 Thread Julian Fondren via Digitalmars-d-learn
On Thursday, 23 November 2023 at 17:46:55 UTC, DLearner wrote: I just find it surprising that your suggestion worked, but the (slightly simpler) earlier version did not. The `enum` answer? That also works, but you have to make a change at the callsite as well, to `mixin(mxnTest!("Var_A",

comparing with c strings

2023-11-23 Thread denis via Digitalmars-d-learn
Let's say I have a D application, with some callbacks from C, where some arguments to the callbacks are `const char* path`. What is the recommended way to compare them to D strings? Without making allocations, if that's possible

Re: mixin under -betterC

2023-11-23 Thread DLearner via Digitalmars-d-learn
On Thursday, 23 November 2023 at 17:03:29 UTC, Julian Fondren wrote: On Thursday, 23 November 2023 at 16:33:52 UTC, DLearner wrote: Why is this so, bearing in mind the concatenations are executed at compile, not run, time? If you compile without -betterC, it'll work, but if you examine the

Re: mixin under -betterC

2023-11-23 Thread Julian Fondren via Digitalmars-d-learn
On Thursday, 23 November 2023 at 16:33:52 UTC, DLearner wrote: Why is this so, bearing in mind the concatenations are executed at compile, not run, time? If you compile without -betterC, it'll work, but if you examine the result you'll find that the mxnTest function is still compiled into

Re: mixin under -betterC

2023-11-23 Thread Paul Backus via Digitalmars-d-learn
On Thursday, 23 November 2023 at 16:33:52 UTC, DLearner wrote: Code below is intended to test simple mixin with lambda function under -betterC. Works with full-D, but fails with 'needs GC' errors under -betterC. Why is this so, bearing in mind the concatenations are executed at compile, not

mixin under -betterC

2023-11-23 Thread DLearner via Digitalmars-d-learn
Code below is intended to test simple mixin with lambda function under -betterC. Works with full-D, but fails with 'needs GC' errors under -betterC. Why is this so, bearing in mind the concatenations are executed at compile, not run, time? ``` // Test harness extern(C) void main() {