You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Tolstokulakov Nikolay (JIRA)" <ji...@apache.org> on 2015/11/30 06:44:11 UTC

[jira] [Updated] (THRIFT-3456) static assert fails

     [ https://issues.apache.org/jira/browse/THRIFT-3456?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tolstokulakov Nikolay updated THRIFT-3456:
------------------------------------------
    Description: 
thrift.codegen.idlgen

 static assert(structIdlString!WithDefaults ==
 `struct WithDefaults {
   -1: string a = "asdf",
  -2: double b = 3.1415,
   1: WithoutMeta c = {a: "foo", b: 3, },
 }
 `);

This assert fails for me, because struct contains double b = 3.1414999...999
I suggest replace 3.1415 with 1.0e+20 
This value is free from rounding issues.

FYI
thrift.internal.ctfe contains similar unit test, but it is not use strict match:
static assert(ctfeToString(3.1415).startsWith("3.141"));

Create pull request: https://github.com/apache/thrift/pull/720


  was:
thrift.codegen.idlgen

 static assert(structIdlString!WithDefaults ==
 `struct WithDefaults {
   -1: string a = "asdf",
  -2: double b = 3.1415,
   1: WithoutMeta c = {a: "foo", b: 3, },
 }
 `);

This assert fails for me, because struct contains double b = 3.1414999...999
I suggest replace 3.1415 with 1.0e+20 
This value is free from rounding issues.

FYI
thrift.internal.ctfe contains similar unit test, but it is not use strict match:
static assert(ctfeToString(3.1415).startsWith("3.141"));



> static assert fails
> -------------------
>
>                 Key: THRIFT-3456
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3456
>             Project: Thrift
>          Issue Type: Bug
>          Components: D - Compiler
>            Reporter: Tolstokulakov Nikolay
>
> thrift.codegen.idlgen
>  static assert(structIdlString!WithDefaults ==
>  `struct WithDefaults {
>    -1: string a = "asdf",
>   -2: double b = 3.1415,
>    1: WithoutMeta c = {a: "foo", b: 3, },
>  }
>  `);
> This assert fails for me, because struct contains double b = 3.1414999...999
> I suggest replace 3.1415 with 1.0e+20 
> This value is free from rounding issues.
> FYI
> thrift.internal.ctfe contains similar unit test, but it is not use strict match:
> static assert(ctfeToString(3.1415).startsWith("3.141"));
> Create pull request: https://github.com/apache/thrift/pull/720



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)