CASE TypeClass OF __SYSTEM.TYPE_CLASS.TYPE_ANYINT Never Reached?

2023-05-02
2023-05-03
  • thecolonel26 - 2023-05-02

    Why is SYSTEM.TYPE_CLASS.TYPE_ANYINT never reached? If I pass it a LINT?

    And if it's not possible you use SYSTEM.TYPE_CLASS.TYPE_ANYINT for comparison this what is the point?

    VAR_INPUT
        Value : ANY;
    END_VAR
    
    
    // Body
    CASE Value.TypeClass OF
        __SYSTEM.TYPE_CLASS.TYPE_ANYINT:        
            LogWrapper(LogClass.LOG_INFO,'Value is an int type'); // this is never reached
        __SYSTEM.TYPE_CLASS.TYPE_ANYREAL:
            LogWrapper(LogClass.LOG_INFO,'Value is a real type'); // this is never reached
        __SYSTEM.TYPE_CLASS.TYPE_BOOL:
            LogWrapper(LogClass.LOG_INFO,'Value is a bool');
        __SYSTEM.TYPE_CLASS.TYPE_LINT:
            LogWrapper(LogClass.LOG_WARNING, 'Type LINT, is this should never be reached'); // This is reached but should not be
        __SYSTEM.TYPE_CLASS.TYPE_LREAL:
            LogWrapper(LogClass.LOG_WARNING, 'Type LREAL, is this should never be reached'); // This is reached but should not be
    END_CASE
    
     

    Last edit: thecolonel26 2023-05-02
  • Fless

    Fless - 2023-05-03

    TYPE_ANYINT is the generic data type used for declarations.
    TypeClass only returns the elementary data type.

    See the table in Data Type: ANY

     

Log in to post a comment.