Opened 16 years ago
Closed 16 years ago
#1386 closed Feature Request (Rejected)
Union support
| Reported by: | monoceres | Owned by: | |
|---|---|---|---|
| Milestone: | Component: | AutoIt | |
| Version: | Severity: | None | |
| Keywords: | union dll | Cc: |
Description
Working with unions in dllstructs is extremely annoying and tiresome to work with. If autoit could provide some easier way it would be superb.
Attachments (0)
Change History (4)
comment:1 by , 16 years ago
| Version: | 3.3.2.0 |
|---|
comment:3 by , 16 years ago
Syntax is tricky. DllUnionCreate() is the obvious solution, but makes it rather useless since most unions in the wild are found in structs with other members as well.
Maybe something like this?
DllStructCreate("int;{short;float;double;}")
Where everything inside the {} is treated as a union. If it could be nested then it would be perfect. It would solve any kind of data format involving unions I've seen.
comment:4 by , 16 years ago
| Resolution: | → Rejected |
|---|---|
| Status: | new → closed |
That syntax won't work. DllStructGetData() wouldn't know what to return. Thinking about it, why is this an issue? Don't you know at compile time which particular piece of data you want? For example, in your example, assume you want to use the "short" data. You calculate the size of the member to be 64-bits (the size of the largest union member which is double). Thus you would use int64. I can't imagine it being very common that you need to access more than one type of union members.
I think I'm going to close this as rejected because:
- I don't see many unions.
- The syntax is going to be difficult to get usable in order for AutoIt to do the right thing.
- My experience with unions has been that I needed one of the data types so in AutoIt I would just use the best size type for that data-type.

Automatic ticket cleanup.