Examples of using This pointer in English and their translations into Russian
{-}
-
Official
-
Colloquial
This pointer is never equal to zero.
Still Comparing"this" Pointer to Null?
But this pointer is not used, is it?
In the console application, you can use this pointer as follows.
This" pointer is passed as a parameter.
As specified by the modern C++ standard, the this pointer can never be null.
This pointer can be passed to the wcscpy_s() function.
There are many functions in the libraries' code that check the this pointer.
The memory for this pointer is allocated by the gcnew utility.
In the same way the compiler can optimize the code comparing"this" pointer to null.
This pointer is called" pointer of fixing.
And now we have a tool that allows us to modify memory by this pointer.
Incrementing this pointer will increment its value by 4 the size of the element.
Then, in some method,you can use this pointer as follows.
The"this" pointer is considered an integer argument, so it is always put into the RCX register.
The subsequent code gets control only when this pointer equals zero, and dereferences it.
This pointer is not dereferenced and one may find it strange that the analyzer generates the V595 warning here.
What's worse is that this pointer gets dereferenced before this check.
But here a character is cast to a pointer and some memory area is modified by this pointer.
If it happens so, that this pointer will really be null, then we will have some confusion here.
The apr_snprintf() function accepts the'errbuf' pointer and the size of this pointer'sizeof errbuf' as arguments.
In this case, the this pointer inside such a function is of type object_type const* const rather than merely of type object_type* const.
Whether the error will reveal itself or not depends upon the area of memory where the object is created,referred to by the"this" pointer.
Then the programmer suddenly suspects this pointer might equal NULL and makes a check for that.
If'pceltFetched' is not a null pointer, the function must increment the variable of the ULONG type this pointer refers to.
The thing is that we see the dereference of this pointer during the call of the function NewName: e->src.
Using this pointer the function accesses the necessary memory locations where the passed variable is located and can change its value.
The analyzer has detected a dangerous conversion of the"this" pointer to the"void*" type followed by a conversion of"void*" back to the class type.
Further in the code we see a call of a function that takes offset pointer as one of the parameters, which references to the variable that was already destroyed;this can lead to an error during the work with this pointer.
First, since the this pointer can never be null, according to the C++ standard, the compiler may optimize the method call by reducing it to the following line.