![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Nov 2005
Location: Moseley, Birmingham, England, Earth
Posts: 51
Rep Power: 3
![]() |
Unions
How are unions declared in Delphi? I know they're something like this:
type TRecord = record case Integer of 0: (A: Integer); 1: (B: Single); end; But I don't understand exactly what's going on. |
|
|
|
|
|
#2 |
|
Programmer
Join Date: Jun 2005
Posts: 86
Rep Power: 4
![]() |
Pascal is actually a very type-strict language and this is actually one of the documented ways that Wirth himself specified to break type checking. It is part of the PASCAL language specification.
Another way is: type TRecord = record case Boolean of False: (A: Integer); True: (B: Single); end; |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|