Skip to content

Commit b84f6c4

Browse files
Remove dependency on the C++ standard library
Update README
1 parent 6657523 commit b84f6c4

4 files changed

Lines changed: 222 additions & 220 deletions

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,14 @@ C++ is a much larger language than C# and some developers will prefer having mor
5656

5757
While IL2CPP transforms C# into C++ already, it generates a lot of overhead. There are many [surprises](http://jacksondunstan.com/articles/3916) if you read through the generated C++. For example, there's overhead for any function using a static variable and an extra two pointers are stored at the beginning of every class. The same goes for all sorts of features such as `sizeof()`, mandatory null checks, and so forth. Instead, you could write C++ directly and not need to work around IL2CPP.
5858

59+
## Industry Standard Language
60+
61+
C++ is the standard language for video games as well as many other fields. By programming in C++ you can more easily transfer your skills and code to and from non-Unity projects. For example, you can avoid lock-in by using the same language (C++) that you'd use in the Unreal or Lumberyard engines.
62+
5963
# UnityNativeScripting Features
6064

61-
* Supports Windows, macOS, iOS, and Android (editor and standalone)
65+
* Supports Windows, macOS, Linux, iOS, and Android (editor and standalone)
66+
* Works with Unity 2017.x and 5.x
6267
* Plays nice with other C# scripts- no need to use 100% C++
6368
* Object-oriented API just like in C#
6469

Unity/Assets/NativeScript/Editor/GenerateBindings.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7399,7 +7399,7 @@ static void AppendCppBaseTypeAssignmentOperatorNullptr(
73997399
typeParams,
74007400
output);
74017401
output.Append(
7402-
"::operator=(std::nullptr_t other)\n");
7402+
"::operator=(decltype(nullptr) other)\n");
74037403
AppendIndent(
74047404
cppMethodDefinitionsIndent,
74057405
output);
@@ -7913,7 +7913,7 @@ static void AppendCppBaseTypeNullptrConstructor(
79137913
AppendTypeNameWithoutGenericSuffix(
79147914
numberedTypeName,
79157915
output);
7916-
output.Append("(std::nullptr_t n)\n");
7916+
output.Append("(decltype(nullptr) n)\n");
79177917
AppendIndent(
79187918
cppMethodDefinitionsIndent,
79197919
output);
@@ -9125,7 +9125,7 @@ static void AppendCppTypeDefinitionBegin(
91259125
AppendCppTypeParameters(
91269126
typeParams,
91279127
output);
9128-
output.Append("(std::nullptr_t n);\n");
9128+
output.Append("(decltype(nullptr) n);\n");
91299129

91309130
// Constructor from handle
91319131
AppendIndent(indent + 1, output);
@@ -9208,7 +9208,7 @@ static void AppendCppTypeDefinitionBegin(
92089208
AppendCppTypeParameters(
92099209
typeParams,
92109210
output);
9211-
output.Append("& operator=(std::nullptr_t other);\n");
9211+
output.Append("& operator=(decltype(nullptr) other);\n");
92129212

92139213
// Move assignment operator to same type
92149214
AppendIndent(indent + 1, output);
@@ -9310,7 +9310,7 @@ static int AppendCppMethodDefinitionsBegin(
93109310
AppendTypeNameWithoutGenericSuffix(
93119311
enclosingTypeName,
93129312
output);
9313-
output.Append("(std::nullptr_t n)\n");
9313+
output.Append("(decltype(nullptr) n)\n");
93149314
AppendIndent(indent, output);
93159315
output.Append("\t: ");
93169316
AppendTypeNameWithoutGenericSuffix(
@@ -9531,7 +9531,7 @@ static int AppendCppMethodDefinitionsBegin(
95319531
AppendCppTypeParameters(
95329532
enclosingTypeParams,
95339533
output);
9534-
output.Append("::operator=(std::nullptr_t other)\n");
9534+
output.Append("::operator=(decltype(nullptr) other)\n");
95359535
AppendIndent(indent, output);
95369536
output.Append("{\n");
95379537
AppendIndent(indent, output);

0 commit comments

Comments
 (0)