![]() |
UDT problems - Printable Version +- QB64 Phoenix Edition (https://qb64phoenix.com/forum) +-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1) +--- Forum: Code and Stuff (https://qb64phoenix.com/forum/forumdisplay.php?fid=3) +---- Forum: Help Me! (https://qb64phoenix.com/forum/forumdisplay.php?fid=10) +---- Thread: UDT problems (/showthread.php?tid=2155) |
UDT problems - eoredson - 11-12-2023 Neither of these 2 functions work: Code: (Select All) Type BitStruct Code: (Select All) type StructType RE: UDT problems - TerryRitchie - 11-12-2023 (11-12-2023, 05:46 AM)eoredson Wrote: Neither of these 2 functions work:Bit length variables and arrays are not allowed inside UDTs. RE: UDT problems - eoredson - 11-12-2023 So are you saying it can't be done or nobody wants to!? RE: UDT problems - SpriggsySpriggs - 11-12-2023 He's saying it isn't able to be done. Also, it isn't something worth implementing. RE: UDT problems - mnrvovrfc - 11-12-2023 (11-12-2023, 06:05 AM)eoredson Wrote: So are you saying it can't be done or nobody wants to!? Code: (Select All) Type BitStruct Why do you want an UDT variable as opposed to a variable which straight out declared ```AS _BIT```? Not even C++ allows a "property" to occupy seven bits or less, let alone only one. I used "property" as term coming from OOP as synonym for "field". Although "bit fields" do exist they are for maniacs to handle. As was already said around here many times before, if you need an array as UDT field member, make it type ```_MEM``` and use the statements and functions from that gang, that's what they are there for. It's clunky but to make it "prettier" than that, you will have to begin your bid today to transform QB64 into an object-oriented programming language. You should know that you could also use a ```STRING * whatever``` variable and parse it, although it will be slow and it's a PITA sometimes working with FLS. The additional advantage of the "string list", though is that you could set whatever values of "array" elements you please, ie. mix the types, as long as you know how to program for what to look for. RE: UDT problems - eoredson - 11-12-2023 (11-12-2023, 06:19 AM)SpriggsySpriggs Wrote: He's saying it isn't able to be done. Also, it isn't something worth implementing.Yet QB64PE claims to be QB45 compatible which has UDT arrays... Is a question of principle. RE: UDT problems - TerryRitchie - 11-12-2023 (11-12-2023, 06:19 AM)SpriggsySpriggs Wrote: He's saying it isn't able to be done. Also, it isn't something worth implementing.Implementing the _BIT in UDTs I agree is not useful but allowing the use of arrays in UDTs would be monumental. ![]() RE: UDT problems - eoredson - 11-12-2023 (11-12-2023, 06:44 AM)TerryRitchie Wrote:(11-12-2023, 06:19 AM)SpriggsySpriggs Wrote: He's saying it isn't able to be done. Also, it isn't something worth implementing.Implementing the _BIT in UDTs I agree is not useful but allowing the use of arrays in UDTs would be monumental. Thank you for stating the obvious!! Because I have several products with UDT arrays which need to be edited. Erik. RE: UDT problems - TerryRitchie - 11-12-2023 If you need bits (presumably as flags) you could always use a _BYTE and manipulate each of the 8 bits. This will give you 8 flags to choose from. Code: (Select All) TYPE BitStruct RE: UDT problems - TerryRitchie - 11-12-2023 (11-12-2023, 06:50 AM)eoredson Wrote:Was it written in QuickBasic? QuickBasic never allowed arrays in UDTs. I don't remember if VBDOS did though.(11-12-2023, 06:44 AM)TerryRitchie Wrote:(11-12-2023, 06:19 AM)SpriggsySpriggs Wrote: He's saying it isn't able to be done. Also, it isn't something worth implementing.Implementing the _BIT in UDTs I agree is not useful but allowing the use of arrays in UDTs would be monumental. Edit: I just looked it up, both QB7.1(BC7/PDS) and VBDOS(v1.00) did allow arrays in UDTs. |