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

UNSIGNED gets implicitly cast to BOOLEAN in spite of documentation to the contrary


    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 7.0.x
    • Fix Version/s: 7.8.0
    • Component/s: Code Generator
    • Labels:


      Reading the language reference, I’m not sure if an implicit cast of an UNSIGNED to a BOOLEAN is expected or not (not sure what the highlighted section below was meaning to convey):

       During expression evaluation, different value types may be implicitly cast in order to properly evaluate the expression. Implicit casting always means promoting one value type to another: INTEGER to STRING or INTEGER to REAL. BOOLEAN types may not be involved in mixed mode expressions.


      I was looking at an issue recently, and the code effectively was written like this (simplified example):

           Somefunc(STRING str, BOOLEAN isConfirmed = FALSE, UNSIGNED seq = 1) := FUNCTION

                   s := str + seq;

                   c := IF(isConfirmed, 'CONFIRMED: ', 'NOT CONFIRMED: ');

                   RETURN c + s;                   


       The calling code was not correctly aligned with the function parameters:

            Foo := Somefunc(‘bar’, 8);

       This produced no warning, but didn’t function the way the developer intended. 


      If there is concern that changing this behavior would break a lot of existing code, it would at least be beneficial for this to generate a warning.


      Gavin Halliday 


          Issue Links



              • Assignee:
                ghalliday Gavin Halliday
                kev77log Kevin Logemann
              • Votes:
                0 Vote for this issue
                3 Start watching this issue


                • Created: