Hi cplusplus, first time poster and I've only been really heavily using C++ for the past week or so, so please forgive my confusion with syntax. I'm currently working with the scientific graphing software ROOT and hope that this operand is universal across C++ and not specific to this program. Basically what I'm currently doing is slowly moving through the tutorials provided on the ROOT website and going line by line and learning what each individual function does in an effort to better understand how they all work together to create the program at large and ran into a problem when using a certain math method. Looking at the header file which actually contains the definition for this method, I found the following code:
1 2 3
inline Short_t TMath::Max(Short_t a, Short_t b) {
return a >= b ? a : b;
}
I've never seen this syntax before and, after trying several different methods of searching Google for help with it, I've been unsuccessful in finding out what it means. My guess is that it simply checks to see whether a is greater than or equal to b and, if so, returns a. Otherwise it returns b. I just figured I should make sure so that I'm not getting the wrong idea from the method. And just in case the Short_t variable declaration isn't universal, it's just for easier conversion to Matlab.