mbeddr / mbeddr.core

The mbeddr core. An extensible C
Eclipse Public License 2.0
223 stars 77 forks source link

mbeddr doesn't allow single value array initialization #1295

Open enikao opened 8 years ago

enikao commented 8 years ago

C allows something like

double d[100] = {0.0};

to initialize every member of d with value 0.0. mbeddr flags an error on this:

array size does not match (expected: 100 was: 1)

coolya commented 8 years ago

It works for {0} but not for {0.0} because BigDecimal.equals(0) returns false in this case.

coolya commented 8 years ago

The problem is even more funny because of java amazing super intelligence:

new BigDecimal(0.0).equals(0) == false

We might get around this by using IComparables compareTo method which should return 0 in this case