TrinityCore/TrinityCore — comment on commit afc18461d76b74f1e6dfaccebb3689e4ec2c2012
File:  line 0
By Warpten:

in that case you are using a class pointer as parameter for fnc() and calling a member function of it.

Now, about this syntax:

```c++
(function() { /* whateva */ })()
```

This is used in JavaScript (I'm reffering to JS because i discovered this when I was learning JS) and reffered to as “self-executing anonymous function”. The advantage of such a code style is that it encloses every of the function between parenthesis's values, params, etc, into their own *anonymous* scope. I'm going to give you some examples of the advantages of such structures using JavaScript, because it's the easiest testable thing:

http://jsfiddle.net/z7w4Z/1/
If you test it, it is noticeable that this is quite bugged. What is the reason for this ? The `for() {}` loop is called when the document is loaded. However, you do not click links when the document is loaded, you click them AFTER it is loaded and rendered in your browser. That means that every time you click on a link, the JavaScript hook tries to grab the i value used. However, there is no i variable that is local to the « click » scope, but there is one that is in the document scope. And the script will use this one as the value to use, rendering an incorrect script.

http://jsfiddle.net/z7w4Z/2/
This one works. Why ? Because it's using an anonymous function that is executed as soon as declared. This anonymous function takes the increment used in the `for` loop and stores it into it's own variable called thisI (note that you could keep using i instead of `thisI`, since thats not the global scope)