News for hackers. Stuff that matters.
Re:Returning multiple values from functions in C++ by m_mueller on Monday March 07, 2016 @02:18AM (#11237576)
You're right, I have been thinking about this naming as well. I think in this context, "INT_PARAM" would be better. I like to typedef it because this way it's easier to replace with a hardware specific integer type later on if I decide to do so. Anyways, the "VALUE" naming is coming from Fortran, which is by default pass-by-reference, so you use it to get pass-by-value.

Edit: Thinking about it some more, "INT_VALUE" still makes sense - it makes it clear that this specific symbol should be accessed as a value, not as a pointer. Doing this reminds me that I'm (probably) imposing more register pressure by passing by value. In general I'd probably pass a const int * const pointer here, but in this specific case I needed values because of some CUDA specific limitation.

Re:Returning multiple values from functions in C++ by Rexxar on Monday March 07, 2016 @02:56AM (#11237668)
> Doing this reminds me that I'm (probably) imposing more register pressure by passing by value.

Not for "int"s, I would be very surprised if sizeof(int*) < sizeof(int) on your system.

Re:Returning multiple values from functions in C++ by m_mueller on Monday March 07, 2016 @03:41AM (#11237803)
Good point, that was a bit of a brainfart of mine.