Anonymous structures in StructureUnion

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User_Russian
Addict
Addict
Posts: 1518
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Anonymous structures in StructureUnion

Post 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.
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: Anonymous structures in StructureUnion

Post 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:
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: Anonymous structures in StructureUnion

Post 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:
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
Post Reply