The "*" symbol is not used here for multiplication but it is used to signify that we are talking about a pointer. * p_VolumeAtPriceAtIndex refers not to the value of p_VolumeAtPriceAtIndex but to the value pointed by p_VolumeAtPriceAtIndex.
This line is the declaration of this pointer and my wild guess is that s_VolumeAtPriceV2 is the variable type.
I still have to fully understand this but it seems like I have clue.
Note that technically C++ does not have a "NULL" type, that's more of a C thing. NULL is not always typesafe therefore the "official" recommendation in C++ is to use 0.
Not that it really matters in practice as it's a bit of a pedantic exercise.
Edit to clarify and add more information (sorry was in an unnecessary rush before):
Stroustrup himself (inventor of C++) plus a few other well known people is where I got the "official" recommendation from (technically there is nothing actually official about it which is why I quote it). See here: Stroustrup: C++ Style and Technique FAQ
The new C++11 has a "nullptr" keyword which serves the purpose of the old NULL in a typesafe way. Right now support for that is highly dependent on your compiler which is why I personally still use 0.
Last edited by Ymmv; June 29th, 2012 at 06:44 PM.
The following user says Thank You to Ymmv for this post:
We will have to agree to disagree on the use of NULL. Obviously, using zero can be confusing or questions like this don't come up. If it had been NULL, then the new user can at least figure it out and look it up. It also makes scanning code easier, as searching for zero is going to have a few hits, while NULL is what it is.
If you read the ref, you will see it is talking about type safety (which NULL obviously isn't), but zero is not either. The other point they make is about dealing with pre-standard code (aka really old crap), and while that can be an issue in the really big picture, it is a non-issue for an indicator or anything that people are doing at this level.
Defining another macro for nullptr is a good tradeoff if you want future compatibility.
The following user says Thank You to aslan for this post:
I don't think we're disagreeing per se because I wasn't trying to make an argument, only to explain the rational behind my personal choice. As I said, it's a bit of a pedantic exercise. I base my choices on what I have learned from other professionals and my own experience but that doesn't mean the other option is wrong. Especially in this case where NULL is very often the exact same thing as 0. Just be consistent.