Jump to content

Lars Fosdal

Administrators
  • Content Count

    3323
  • Joined

  • Last visited

  • Days Won

    110

Posts posted by Lars Fosdal


  1. 5 hours ago, Ondrej Kelle said:

    Not really when writing my own code, I try to avoid them if possible.

    Sometimes for interop with an API, e.g. when translating C headers where enums are already declared that way.

    Or when you need to support a binary format which uses some specific ordinal values, then it depends - you might still prefer to use an enum but avoid conversion.

    I still prefer using regular constants for bit-fiddling.

    • Like 1

  2. 19 hours ago, Stefan Glienke said:

    When used in a set, the ordinal value of the enum is basically the index of the bit used within the set and as they can only be 256 bit in size any ordinal value above 255 prevents an enum being used as a set.

    Personally I think you should rather avoid giving enums any ordinal values and only ever use them when using some interop with another system where they are used for.

    Isn't there something weird about RTTI for enums that have manually set ordinal values as well?


  3. Off-topic: There is another oddity with enumerations with explicit ordinal values.


    TEnum = (plough = 5, foo = 9, bar = 14, wtf = 1000);
    The above is valid, but wtf can't be used in a set.

    Makes me wonder if it would be better to generally do sets as dynamic arrays, instead of today's implementation of sets.
    I guess it would be more expensive.


  4. I think it could be fantastic if it was possible to design custom property lists per class.  The first time a class is seen, it could be added to a list of class property configs, with all the props present.  In a config dialog somewhere, it could be possible to enable/disable each prop.  The filter could even use digits 0..9 to select one of multiple configurations per class. Naturally, if it could be installed with default filters for many of the standard components, that would be nice. I really like the idea - more than I like quick edit. Nice work!

    • Thanks 1

  5. 2 minutes ago, Stefan Glienke said:

    You should take a break - because it in fact is related to the ordinal value. The order is wtf, plough, foo, bar - but your array was wtf, plough, bar, foo

    Declared:   TEnum = (plough, foo, bar, wtf)
    Test order: [wtf, plough, bar, foo]

    Looping an Enum Set
    1 wtf
    5 plough
    9 foo
    14 bar

    Looping an Enum Array
    1 wtf
    5 plough
    14 bar
    9 foo

    Press Enter:

     

    You are right, @Stefan Glienke -I am so logging off now 😄

    • Haha 2
×