Page 1 of 1

Anonymous structures in StructureUnion

Posted: Mon Feb 10, 2014 7:30 pm
by User_Russian
Please add аnonymous structures in StructureUnion.
For example, there is a structure LARGE_INTEGER.

Code: Select all

typedef union _LARGE_INTEGER {
  struct {
    DWORD LowPart;
    LONG  HighPart;
  };
  LONGLONG QuadPart;
} LARGE_INTEGER, *PLARGE_INTEGER;
Translated to PB, looks so.

Code: Select all

Structure LARGE_INTEGER
  StructureUnion
    
    Structure
      LowPart.l
      HighPart.l
    EndStructure
    
    QuadPart.q
    
  EndStructureUnion
EndStructure
But PB not support this syntax, and it is necessary to add a new structure, which is inconvenient.

Code: Select all

Structure LARGE_INTEGER_
  LowPart.l
  HighPart.l
EndStructure

Structure LARGE_INTEGER
  StructureUnion
    x.LARGE_INTEGER_
    QuadPart.q
  EndStructureUnion
EndStructure
More would be great if you add bitfields in structures.

Re: Anonymous structures in StructureUnion

Posted: Mon Feb 10, 2014 10:32 pm
by Thunder93
User_Russian wrote: More would be great if you add bitfields in structures.
+1, That also was mine.. :) - http://www.purebasic.fr/english/viewtop ... =3&t=56923

Where was you when I posted? I could have used +1 :lol:

Re: Anonymous structures in StructureUnion

Posted: Thu Jun 16, 2016 4:38 am
by Thunder93
But PB not support this syntax, and it is necessary to add a new structure, which is inconvenient.
I've just encountered this issue, and I can vouch that I was inconvenienced. :wink:

So I also vote for this PB enhancement. :mrgreen: