This week we’ll take a break from the C++ Scripting series to explore three optimizations we can make to our C# code so that IL2CPP generates faster C++ code for us. We’ll cover three areas that yield big speedups: casting, array bounds checking, and null checking.
Posts Tagged null
It’s been quite a while in the series since we’ve added any fundamental C# language features. Today we’ll address one of the limitations of the C#/C++ communication: the lack of support for
ref parameters. This is important as they’re commonly used by both the Unity API and .NET and we’d like C++ to be able to call functions with these kinds of parameters. So let’s delve into what it means for C++ to use
ref parameters and see how to implement support for that across the language boundary.
We all use
>= with integers and floating point values all the time. It just works and it’s built into basically every programming language. These simple operators suddenly become quite a pain when you start wanting to compare other objects.
IComparable seems to make it easier, but there’s some trickiness when you start dealing with
null objects. Today’s article explores this and ends up with some handy utility functions to take some of the gotchas out of comparing.