the out means that the variable you put in does not have to be initialized before it goes in, but will be before it comes out...
[snip]
the ref means that the variable you put in has to be initialize before it goes in but any changes made in the function to that variable is made is made in the scope above it...
|
Neither of these are true. 'out' and 'ref' have absolutely no significance at all and aren't even C++ keywords.
Some APIs #define them as macros so they can put it in function declarations to make the API easier to understand, but doing so is merely for your convenience and has no impact in the code.
Basically what I'm getting at, is those APIs are doing this:
1 2 3 4 5 6 7 8
|
#define out
#define ref
// note: they're #defined as nothing
int func(out int h);
// since 'out' is #defined as nothing, the above is the same as this:
int func( int h); // the compiler just erases the 'out'
|
You could just as easily say
int func(banana int h);
if you choose to #define banana. But it really has no significance.
what does it mean if I have:
something function(const int h) |
it means that 'h' is constant and cannot be modified in your code. IE: trying to do
h = 5;
would give you a compiler error because you're trying to modify a constant.
and are there other modifier like that out there that i don't know about? |
Yes, volatile and restrict are two that I know of. Intrexa also linked to a page that listed several other keywords, some of which might also qualify (although many are MS specific keywords and not really C++ keywords)