1

1)

typedef union __rfun_gop_event_info
{
 unsigned int evt;
 struct
 {
  unsigned int reserved1:1;
  unsigned int reserved0:1;
  unsigned int f30:1;
  unsigned int f29:1;
 }frame;
}rfun_gop_event_info;

2)

typedef union __rfun_gop_event_info
{
 unsigned int evt;
 struct
 {
  unsigned int reserved1:1;
  unsigned int reserved0:1;
  unsigned int f30:1;
  unsigned int f29:1;
 }frame;
}rfun_gop_event_info;

Thank you.

4
  • Please use the "code" feature to render your code samples.
    – Apalala
    Jan 10, 2011 at 12:11
  • 1
    check this question - stackoverflow.com/questions/282019/…
    – Vladimir
    Jan 10, 2011 at 12:13
  • the obly hassle is - Object Pascal requires to put variant parts at the end of structure Jan 10, 2011 at 15:05
  • Was it your intention to post the same block of code twice? Perhaps the second one was supposed to be different. Jan 10, 2011 at 18:58

1 Answer 1

3

Have a look at this article at Delphi Corner that explains variant records which is exactly what you need:

DelphiCorner: Variant Records: The equivalent to the C-union structure

Excerpt containing example:

type
 TPerson = record
   FirstName, LastName: string[40];
   BirthDate: TDate;
   case Citizen: Boolean of
     True: (BirthPlace: string[40]);
     False: (Country: string[20];
       EntryPort: string[20];
       EntryDate: TDate;
       ExitDate: TDate);
 end;
1
  • The bit fields are the real problem here Oct 8, 2014 at 21:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.