SImple C++ code to D
Alexandre via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Jul 14 06:34:13 PDT 2014
bearophile, Thanks for all help!
As I said, I'm coming from C # and C + +, I need to learn
"tricks" of D language...
'm reading this book: http://ddili.org/ders/d.en/
I have a struct with union...
struct IMAGE_SECTION_HEADER
{
BYTE[8] Name;
union Misc
{
DWORD PhysicalAddress,
VirtualSize;
}
DWORD VirtualAddress,
SizeOfRawData,
PointerToRawData,
PointerToRelocations,
PointerToLinenumbers;
WORD NumberOfRelocations,
NumberOfLinenumbers;
DWORD Characteristics;
}
( the identation is wrong here... )
Btw, my problem is, how to acess the union elements ?
I try this:
//...
scth[0].Misc.VirtualSize = 15;
//...
But, the compiler return that error:
main.d(151): Error: need 'this' for 'VirtualSize' of type 'uint'
On Monday, 14 July 2014 at 13:00:21 UTC, bearophile wrote:
> Alexandre:
>
>> I get a lot of problens, to convert 'strings' to UCHAR... :/
>
> I suggest you to take a look at the D docs and understand what
> D fixed-sized arrays are, dynamic arrays, and strings (that are
> dynamic arrays).
>
> Bye,
> bearophile
More information about the Digitalmars-d-learn
mailing list