If int_T is a 32-bit integer and mwSize is a 64-bit integer (typically size_t, unsigned) then yes it is physically possible to have aproblem.
E.g., if n happens to be bigger than the largest value for an int_T then you would have an infinite loop because the i++ would typically wrap around to a negative value when it overflowed (not required for the compiler to do this, but typically that is what happens). Whether mxGetNumberOfElements could ever return a number this big is another question, and may be dependent on the particular system you are running on.
The i < n test itself may have a problem if int_T is a signed 64-bit and mwSize is an unsigned 64-bit and n happens to be larger than the largest int_T value. Again you would have an infinite loop for the same reason (i < n is always true). This case is not a practical issue, however, because the massive memory that such a value would imply would not be physically possible.
So, I would guess your code will probably work as long as the variable sizes are not too large.
Best Answer