HaxeFoundation / HaxeFoundation/haxe

C++ nullable comparsion problem

Open
#11,259 2 comments 1 reaction 0 assignees View on GitHub
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

**Issued way**

```hx
var numb:Null = null;
if(numb != null)
{
//nullable, null comparsion not working on C++ target
trace("Something wrong with haxe: " + numb);
return;
}

trace("PASS!");
```

Javascript target returns `PASS!` but C++ target returns `Something wrong with haxe: null`

https://try.haxe.org/#c8aE5aD5

**Temporary fixed way**

```hx
var numb:Null = null;
if(Type.typeof(numb) != Type.ValueType.TNull)
{
//Null comparsion working with this way, never calls here!
trace("Something wrong with haxe: " + numb);
return;
}

trace("PASS!");
```
Javascript and C++ target returns `PASS!`

https://try.haxe.org/#58D0d884

**Platform**

OS: Windows 11
Haxe Version: 4.3.1
Hxcpp Version: 4.3.2

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.