HaxeFoundation / HaxeFoundation/haxe

Haxe allows C++ reserved keywords as variable names

Open
#10,302 0 comments 0 reactions 0 assignees View on GitHub
enhancement platform-cpp
Dominant language
Haxe
Stars
6.9k
Forks
715
Avg merge
2d 2h
Merged PRs (30d)
11

Description

I couldn't figure out the cause of my application not compiling to Android target for a long time. I used a variable named `compl` (for "completed") in my code. It turns out it is a reserved word in C++.

Possible solutions for Haxe:
* throw compilation error directly in Haxe when targeting C++ based on reserved keywords list (a lot of work involved)
* use `#undef compl` and undef all newer keywords (also a lot of work involved)
* replace names of the variables on C++ target: `compl` -> `package_line_compl` - package name, line where it was first defined and its name

This is potentially problematic for many other C-specific keywords, but the issue is of low/informative-priority.

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.