Re: Passing D reimplementation of C++ template as argument to a C++ function

2022-09-25 Thread Nicholas Wilson via Digitalmars-d-learn
On Saturday, 24 September 2022 at 07:04:34 UTC, Gregor Mückl 
wrote:

Hi!

I have a D template struct that reimplements a C++ class 
template with identical memory layout for a set of types that 
matter to me. Now, I want to use some C++ functions and classes 
that use these template instances, from D. For that, I want to 
purposefully alias the D and C++ types. However, with the C++ 
type being templated, I don't know how to name that type in a 
extern declaration in D.


[...]


```
extern(C++) extern(C++, class) struct Foo(T) {
   T a, b;
}

alias FooFloat = Foo!float;

extern(C++) void bar(FooFloat f);
```


Deimos libzip bindings review request

2022-09-25 Thread Dmytro Katyukha via Digitalmars-d-learn

Hi,

I have created D bindings for [libzip](https://libzip.org/), and 
i think it would be nice to include these bindings in deimos, 
because standard [std.zip](https://dlang.org/phobos/std_zip.html) 
does not allow to work with large zip archives. But i am not sure 
if i have done it in right way. Especially legal side (licenses, 
authorship, etc).


Thus, i thought that it could be good idea to ask community for 
review before publication to code.dlang.org.


The project for bindings: https://gitlab.com/katyukha/dlibzip

Thanks a lot for any feedback)


Re: Detect uninitialized class var access

2022-09-25 Thread Paul Backus via Digitalmars-d-learn

On Sunday, 25 September 2022 at 03:04:45 UTC, Tejas wrote:

On Saturday, 24 September 2022 at 23:04:00 UTC, rassoc wrote:

On 9/24/22 15:28, Adam D Ruppe via Digitalmars-d-learn wrote:

gdb --args ./your_program

and then it will tell you all the details you want to know 
about when this happens.


Thank you for your input, Adam.  Real shame that there's no 
built-in compiler solution and probably never will be 
according to [1]. :(


[1] https://issues.dlang.org/show_bug.cgi?id=4595


AFAIK diagnostics like that are not possible because Walter 
doesn't want to implement full blown dataflow analysis in the 
compiler since it will slow down the compilation speed of dmd


Implementing such a diagnostic is equivalent, in the general 
case, to solving the halting problem. So even with dataflow 
analysis, there would always be cases where the compiler either 
fails to detect a potential null dereference (false negative), or 
detects one that can't actually happen at runtime (false 
positive).