DMD 1.037 and 2.020 releases

John C johnch_atms at hotmail.com
Wed Nov 26 06:40:45 PST 2008


Kagamin Wrote:

> > - >The 'this' parameter to struct member functions is now a reference type,< I know this was discussed, but how does this change code? Does this forces to change C code when it is ported to D? How to do such porting? Few examples of situations may be useful.
> 
> I'm affraid, this breaks my resource parser
> 
> struct ResourceTable
> {
> 	ushort Shift; //alignment shift count
> 	ResourceType* FirstType()
> 	{
> 		return cast(ResourceType*)(this+1);
> 	}
> }

Try this:

  return cast(ResourceType*)(&this + 1);


More information about the Digitalmars-d-announce mailing list