Posts Tagged parameter

C++ For C# Developers: Part 27 – Template Deduction and Specialization

Tags: , , ,

Template deduction in C++ is like generic type parameter deduction in C#: it allows us to omit template arguments. Template specialization has no C# equivalent, but enables special-casing of templates based on certain arguments. Today we’ll look at how these features can make our code a lot less noisy and also a lot more efficient.

Read the rest of this article »

No Comments

C++ Scripting: Part 31 – Init Improvements

Tags: , ,

The C++ Scripting series continues today by going over some internal improvements that don’t add any features, but make the existing system more robust. We’ve lucked out in a couple of areas and today we’ll take the opportunity to fix them and learn about some inner workings of C++ and C# along the way.

Read the rest of this article »

5 Comments

C++ Scripting: Part 24 – Default Parameters

Tags: , , , , ,

We’ve been able to call methods since the very beginning, but we’ve always had to pass all the parameters. Today we’ll add support for default parameters so you can skip them sometimes. There’s a surprising amount of detail involved with this, so read on to learn some caveats of C#, .NET, and C++.

Read the rest of this article »

No Comments

C++ Scripting: Part 10 – Full Generics Support

Tags: , , , , , , ,

C# APIs are chock-full of generics. Generic types, generic method parameters, generic return types, generic fields, generic properties, deriving from generic types, and generic constructors. We can find all of these in the Unity and .NET APIs. Some are more frequent than others, but we’re going to need support for all of them to make C++ scripting a viable alternative to C#. Today’s article continues the series by adding just that: support for all of these kinds of generics. Let’s dive into how to use them as well as some bonus items added to the project this week.

Read the rest of this article »

No Comments

Garbage Gotchas

Tags: , , , , , , ,

Sometimes it seems like Unity programming is a minefield. Plenty of innocuous-looking code secretly creates garbage and eventually the GC runs and causes a frame hitch. Today’s article is about some of those less-obvious ways to create garbage.

Read the rest of this article »

2 Comments

From AS3 to C#, Part 22: Multi-Threading and Miscellany

Tags: , , ,

Today’s article is the final installment in the series before we wrap things up next week. We’ll talk about C#’s built-in support for multi-threading and cover some odds and ends that were missed in the previous articles.

Read the rest of this article »

No Comments

Default Arguments

Tags: , , , , ,

I’ve talked about var args, the arguments keyword, and even the length of a function that has default arguments, but I’ve never written an article all about default arguments… until today.

Read the rest of this article »

11 Comments

Function Length

Tags: , , , , , ,

In my last article on getProperties, there was one strange finding in the tests of standard classes: the Function class seems to have a length field. What is it? Today we’ll see

Read the rest of this article »

4 Comments

Argument Clash

Tags: , , , ,

I am often burned by MXMLC: the AS3 compiler. When I am, I find this infuriating and look for the reason why this happened. Today I’ll tip you off about this problem and delve into what it means if you happen to trigger it.

Read the rest of this article »

No Comments