Board index » delphi » Delphi equivalent to a C Union?
lathr...@netcom.com (Gunfighter)
![]() Delphi Developer |
Mon, 09 Mar 1998 03:00:00 GMT
|
lathr...@netcom.com (Gunfighter)
![]() Delphi Developer |
Mon, 09 Mar 1998 03:00:00 GMT
Delphi equivalent to a C Union?Ok, in C you can create a "union", which is a double definition of a Can a C programmer who knows what I'm talking about tell me what the Thanks Gunfighter |
geor..
![]() Delphi Developer |
Tue, 10 Mar 1998 03:00:00 GMT
Re:Delphi equivalent to a C Union?Quote> lathr...@netcom.com (Gunfighter) writes: The first part is optional, so that leaves you a pure UNION. Of course if you leave the second part you keep the regular non-variant record, which is equivalent to struct in C example type For more information look for records and variant records in the help. George Blat |
Hallvard Vassbo
![]() Delphi Developer |
Tue, 10 Mar 1998 03:00:00 GMT
Re:Delphi equivalent to a C Union?In <lathropeDF9KBw....@netcom.com> lathr...@netcom.com (Gunfighter) writes: Quote>Ok, in C you can create a "union", which is a double definition of a type -- |
Matt Franco
![]() Delphi Developer |
Tue, 10 Mar 1998 03:00:00 GMT
Re:Delphi equivalent to a C Union? Ok, in C you can create a "union", which is a double definition of a Can a C programmer who knows what I'm talking about tell me what the Thanks Gunfighter Well, I'd resist being called a C programmer, but the standard Pascal a) The safe way has a tag value which is used to distinguish which TYPE SafeVariant = The CASE is the equivalent of the union, and must be the last component b) The yucky C-style way is to omit the tag field, and just guess TYPE VariantView = (AsBytes, AsWord); The common, but wrong, way of doing this is to use a type that is already TYPE { or even } TotallysuckyVariant = But you can see what's wrong with that without my telling you. |
Jim Smit
![]() Delphi Developer |
Sun, 15 Mar 1998 03:00:00 GMT
Re:Delphi equivalent to a C Union?You are talking about variant records. C version of following example: struct Facts { Quote} over-layed. Kind is used as a tag denoting which over-layed field had data. Hope this helps. Send me e-mail if you need more help. Help Topic: record Here is Borland's example: { Record Type Definitions } Here is Borlands help section: Description A record contains components, or fields, that can be of different types. Accessing records You can access the whole record or each field individually. To retrieve information TDateRec.Year If a record contains a subrecord, you can access it using qualifier. Jim |
1. Delphi equivalent to C's UNION?
2. C Union - Pascal Equivalent ?
4. Interbase equivalent to UNION clause
5. sort a union, view of union
6. What is difference between UNION and UNION ALL
7. Delphi 3 CS vs Delphi 5 Prof
8. Delphi 1 equivalent of the Delphi 3 LOCATE command