Uploaded image for project: 'HPCC'
  1. HPCC
  2. HPCC-19674

Request explantation of warning: Global side-effect ASSERT seems to be context dependent - it may not function as expected

    XMLWordPrintable

    Details

    • Type: Question
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 7.0.0
    • Component/s: Code Generator
    • Labels:
      None

      Description

      Us developers are supposed to be removing all warnings from our ECL.

      This 'context dependent' warning is quite prevalent in our code but we're not sure of its meaning, and consequently don't know how to fix.

      Example ECL that generates this type of error:

       EXPORT STRING10 DateTimeDifference(STRING20 sd1,STRING20 sd2) := FUNCTION EXPORT STRING10 DateTimeDifference(STRING20 sd1,STRING20 sd2) := FUNCTION
            /////////////////////////////////////////////////////////////////////////////////////      // Input STRINGs 'YYYY-MM-DD HH:MM:SS'      // Output STRING 'SSSSSSSSSS' i.e number of seconds difference between the two datetimes      /////////////////////////////////////////////////////////////////////////////////////
            UNSIGNED8 SecondsSince1900(STRING20 dt) := FUNCTION
               ASSERT(REGEXFIND('[0-9]{4}-[0-9]{2}-[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}',dt),'Passed Invalid datetime: '+dt,FAIL);         RETURN  lib_date.dayssince1900((INTEGER2)dt[1..4],(INTEGER1)dt[6..7],(INTEGER1)dt[9..10])*86400                +((UNSIGNED8)dt[12..13])*3600                +((UNSIGNED8)dt[15..16])*60                + (UNSIGNED8)dt[18..19];      END;            RETURN INTFORMAT(ABS(SecondsSince1900(sd2)-SecondsSince1900(sd1)),10,1);  END;
      

      Any advice on this would be a great help.

      Thanks

      Allan

        Attachments

          Activity

            People

            • Assignee:
              ghalliday Gavin Halliday
              Reporter:
              allan Allan Francis Wrobel
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: