Modify

Opened 10 years ago

Closed 10 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 Changed 10 years ago by TicketCleanup

  • Version 3.3.2.0 deleted

Automatic ticket cleanup.

comment:2 Changed 10 years ago by Valik

Did you have a specific syntax in mind?

comment:3 Changed 10 years ago by monoceres

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 Changed 10 years ago by Valik

  • Resolution set to Rejected
  • Status changed from new to 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:

  1. I don't see many unions.
  2. The syntax is going to be difficult to get usable in order for AutoIt to do the right thing.
  3. 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.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

Action
as closed The ticket will remain with no owner.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.