HaxeFoundation / HaxeFoundation/haxe

[CPP] Ints equality with bool

Open
#10,945 5 comments 0 reactions 1 assignee Claimed by @Simn View on GitHub
feature-analyzer
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

Hello! Get different results when comparing ints with true in CPP:

```haxe
var k1:Any = 1;
var k2:Any = 2;
trace("Equality:", (k1 == true) , (true == k1) , (k2 == true) , (true == k2));
// (CPP) Equality:,true,true,true,false
// (interp) Equality:,false,false,false,false

```

`(bool)(k1) == true, ::hx::IsEq( true,k1 ), (bool)(k2) == true, ::hx::IsEq( true,k2 )`

I know that in C/CPP, 0 equals false ant other ints equal true, so not sure that something should be done here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.