Under Review
over 2 years ago

enum with no integer and no error

enum
{
    __1 = "test",
    __2,
    __3 = 0
}

println in console:

test
0
0

but according to doc https://developer.garmin.com/connect-iq/monkey-c/functions/

Note that assigning anything other than an integer will cause an error.

Parents
  • I mean to me the real problem is reality doesn't match Garmin documentation, as per usual.

    Then it's up to us to guess what the true intent was (if we even bother to care.)

    I don't understand why enums need to be solely integers, we should be able to have Strings there as well. So I'm kinda happy with the bug being present.

    They don't have to be, unless you're writing C. But seems like Garmin thought they should be. ¯\_(ツ)_/¯

Comment
  • I mean to me the real problem is reality doesn't match Garmin documentation, as per usual.

    Then it's up to us to guess what the true intent was (if we even bother to care.)

    I don't understand why enums need to be solely integers, we should be able to have Strings there as well. So I'm kinda happy with the bug being present.

    They don't have to be, unless you're writing C. But seems like Garmin thought they should be. ¯\_(ツ)_/¯

Children
No Data