Re: C++ / const class pointer signature / unable to find correct D syntax

2018-05-06 Thread Rubn via Digitalmars-d-learn
On Friday, 4 May 2018 at 07:57:26 UTC, Uknown wrote: On Friday, 4 May 2018 at 07:49:02 UTC, Robert M. Münch wrote: I have a static C++ and can't make it to get a correct binding for one function: DMD: public: unsigned int __cdecl b2d::Context2D::_begin(class b2d::Image & __ptr64,class b2d::Co

Re: C++ / const class pointer signature / unable to find correct D syntax

2018-05-04 Thread Uknown via Digitalmars-d-learn
On Friday, 4 May 2018 at 07:49:02 UTC, Robert M. Münch wrote: I have a static C++ and can't make it to get a correct binding for one function: DMD: public: unsigned int __cdecl b2d::Context2D::_begin(class b2d::Image & __ptr64,class b2d::Context2D::InitParams const * __ptr64 const) __ptr64 LI

Re: C const

2011-03-05 Thread Bekenn
On 3/4/2011 11:19 AM, simendsjo wrote: It also says "char const* q". Is "const char*" the same thing in C? For reference: In C, const T* x is the same as T const* x; both declare a mutable pointer to const T. T* const x declares a const pointer to mutable T, for which D has no analogue. I

Re: C const

2011-03-05 Thread Jesse Phillips
Simen kjaeraas Wrote: > > Hopefully I'm not wrong on this, but you should even be able to change > > the type as long as the size is the same. So instead of int you could > > use uint or byte[8]... granted the library will still interpret it as > > int. And of course that is assuming you are

Re: C const

2011-03-05 Thread Simen kjaeraas
Jesse Phillips wrote: simendsjo Wrote: On 04.03.2011 23:10, Jesse Phillips wrote: > Remember that const/immutable, and other attributes/properties aren't going to change the ABI so dropping them will be safer then leaving them. Thanks. Does this apply to all uses of const, or just compl

Re: C const

2011-03-04 Thread Jesse Phillips
simendsjo Wrote: > On 04.03.2011 23:10, Jesse Phillips wrote: > > Remember that const/immutable, and other attributes/properties aren't going > > to change the ABI so dropping them will be safer then leaving them. > > Thanks. Does this apply to all uses of const, or just complex members? Hopefu

Re: C const

2011-03-04 Thread simendsjo
On 04.03.2011 23:10, Jesse Phillips wrote: simendsjo Wrote: So all const modifiers should be dropped everywhere..? And should the const be dropped here? struct somestruct { const struct otherstruct; } All in all the real answer comes down to, is the data modified. Since C makes no guara

Re: C const

2011-03-04 Thread Jesse Phillips
simendsjo Wrote: > So all const modifiers should be dropped everywhere..? > > And should the const be dropped here? > struct somestruct { >const struct otherstruct; > } All in all the real answer comes down to, is the data modified. Since C makes no guarantees you must only declare things c