Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-2616

Double constant that happens to be a whole number (integer) gets converted to int in generated code

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Minor
    • Resolution: Unresolved
    • Affects Version/s: 0.9.1
    • Fix Version/s: None
    • Component/s: Python - Compiler
    • Labels:
      None

      Description

      In Python, the value you use to initialize a constant determines the type it has. When a constant is declared as a double, it should be a double in the generated code, even if it happens to be possible to represent it as an int.

      Example:

      const double RADIUS = 15.0;
      

      will generate the following Python:

      RADIUS = 15
      

      it should have generated this:

      RADIUS = 15.0
      

      Most of the time this is not going to be a problem, but every now and then you get some wrong results when doing math with different types.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              mortenlj Morten Lied Johansen
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: