Re: A question about C++ interop

2020-03-28 Thread evilrat via Digitalmars-d-learn
On Saturday, 28 March 2020 at 19:14:38 UTC, YD wrote: Hi, now I have a further question: when the C++ class A actually has a method that looks like virtual void get_info(std::string ) const = 0; in order to preserve the virtual function table layout (I found that if I omit this

Re: auto vectorization notes

2020-03-28 Thread Bruce Carneal via Digitalmars-d-learn
On Saturday, 28 March 2020 at 18:01:37 UTC, Crayo List wrote: On Saturday, 28 March 2020 at 06:56:14 UTC, Bruce Carneal wrote: On Saturday, 28 March 2020 at 05:21:14 UTC, Crayo List wrote: On Monday, 23 March 2020 at 18:52:16 UTC, Bruce Carneal wrote: [snip] Explicit SIMD code, ispc or other,

Re: A question about C++ interop

2020-03-28 Thread YD via Digitalmars-d-learn
On Saturday, 28 March 2020 at 07:33:38 UTC, Jacob Carlborg wrote: On 2020-03-27 20:17, YD wrote: Hi, I have a C++ header file which looks like     class A {     public:     static A *create();     virtual int f() const = 0;     }; And there is a C++ library file which provides

Re: auto vectorization notes

2020-03-28 Thread Crayo List via Digitalmars-d-learn
On Saturday, 28 March 2020 at 06:56:14 UTC, Bruce Carneal wrote: On Saturday, 28 March 2020 at 05:21:14 UTC, Crayo List wrote: On Monday, 23 March 2020 at 18:52:16 UTC, Bruce Carneal wrote: [snip] (on the downside you have to guard against compiler code-gen performance regressions) auto

Re: A question about C++ interop

2020-03-28 Thread YD via Digitalmars-d-learn
On Saturday, 28 March 2020 at 07:33:38 UTC, Jacob Carlborg wrote: On 2020-03-27 20:17, YD wrote: [...] Classes in D are always passed by reference. Try dropping the pointer in the `create` method: static A create(); Thanks! I got it to work for now.

Re: A question about C++ interop

2020-03-28 Thread Jacob Carlborg via Digitalmars-d-learn
On 2020-03-27 20:17, YD wrote: Hi, I have a C++ header file which looks like     class A {     public:     static A *create();     virtual int f() const = 0;     }; And there is a C++ library file which provides the implementation, so that if I write a C++ program and call    

Re: auto vectorization notes

2020-03-28 Thread Bruce Carneal via Digitalmars-d-learn
On Saturday, 28 March 2020 at 05:21:14 UTC, Crayo List wrote: On Monday, 23 March 2020 at 18:52:16 UTC, Bruce Carneal wrote: [snip] (on the downside you have to guard against compiler code-gen performance regressions) auto vectorization is bad because you never know if your code will get