restrictions on enumeration member name if equal to a reserved operand

mkrispin
2020-04-09
2020-04-10
  • mkrispin

    mkrispin - 2020-04-09

    Hi All,
    I would like to build an enumeration for the main wind directions like N,NNW,NWW etc.
    There is one problem with S, because S is a reserved name for Set in flip-flops.
    How can I declare S as a member of the enumeration WindDir?
    TYPE eWINDDIR :
    (
    N := 1,
    NNE := 2,
    NEE := 3,
    E := 4,
    SEE := 5,
    SSE := 6,
    S := 7,
    SSW := 8,
    SWW := 9,
    W := 10,
    NWW := 11,
    NWN := 12);
    );
    END_TYPE

    Thank You and Best Regards, Michael

     
  • aliazzz

    aliazzz - 2020-04-10

    Hi,

    I have got a workaround for this which is rather painless.
    Just trail it with an underscore like so: S_

    The compiler will accept it and you can use intellisense to find the enumeration quickly;

    (* Example *)
    WindDirection : eWINDDIR := eWINDDIR.S_; // default wind direction is south
    
     
  • mkrispin

    mkrispin - 2020-04-10

    Hi Aliazzz,
    thanks for the Tip.I tried even with quotation and other special Character. Don't know why I did not test with underline, maybe it was late.
    Anyway , I will name now all the 4 main directions to N, E , S, W . Then all have the same 3 char length, and they peak even stronger up :-)

     
  • mkrispin

    mkrispin - 2020-04-10

    Oh, why are the underline left and right of the characters are cut?
    I want to write "N" ...

     
  • mkrispin

    mkrispin - 2020-04-10

    OK, i give up, bend down to the ground and pray to the holy web master, who programmed to change a single underline into a font action, even in quotations :-((

     

Log in to post a comment.