   C++ Pointer vs "a handle"
  So I'm reading through this book on OpenGl and instead of this function returning a pointer to a "Hardware Rendering Context" so that you can pass the address to other functions... the author instead states that 'it returns a handle to the Hardware Rendering Context' What is the difference between the two?Lets say you have a pointer called "pHDC" and a handle "hDC"do you have to use use the (* / dereferencing) operator to access the value in the handle? I'm really confused on what a handle is because it wasn't in any of the c++ books I've read. Any explanation would be great thanks!   
  There's no difference; a handle is just used as a term for a pointer sometimes.  As for dereferencing it, you should check the syntax of the function that you're passing the DC to (or just look at the sample code in the book).   ;  Handle is a very general term. It basically means some way to refer to an object. A pointer is a handle. A reference is a handle. A smart pointer is a handle. You could even consider an index into an array a handle.In this case, I bet that you can't access the value hDC 'refers to' (I can't say that I've seen this specific case). But that shouldn't matter. There should be a set of functions that will take a handle to a hardware rendering context as a parameter. Just pass along the handle and don't worry about accessing whatever it might be referring to.   ;  A handle is nothing C++ specific and therefore also wasn't in your book.You don't have to use the * dereferencing to access the value of the handle.A handle is most of the time just a integer holding a number that has a meaning for the system. For example if you create a texture in OpenGL you get a GLuint with the id of the texture which basically is a handle.   ;  It could be:1) just a pointer. Sometimes people say "handle" when they mean pointer.2) a special kind of object that acts like a pointer, or wraps around a pointer. You might do this to hide access to the real pointer. Or you might not care about hiding the pointer, you could do it for other reasons. One example is the Pimpl idiom. A quick example is something like this:class MyIntHandle {public:  void add1() { *_myData++; } private:  int *_myData;};or 3) in Mac programming, a "handle" is a pointer to a pointer. These are used for larger memory blocks, so that the OS can move the actual memory around without screwing you up. I haven't done Mac-specific programming in a while so I don't know if these are still used.   ;  In C a handle is usually used to enforce encapsulation. The only thing you can do with a handle is pass it to a function, so you can think of it as an 'object' that maintains some state info with associated 'member' functions. If you used a pointer to a struct there would be nothing stopping the user from accessing the struct members directly. Often a handle is a pointer to something, but you don't know what that something is, so you can't mess with its internals, except through the established interface (i.e. by using the functions that take that handle as an argument).   ;  Thanks a lot! that information definitely helped me :)   ;  A handle is typically a term for something which is simply an internal value of some sort. Often, it's an offset into an internal object array. Handles are frequently used as black-box versions of pointers; unlike pointers, there's usually no legal operations defined on them except passing them around.   ;Required reading.;  Handles can sometimes also be a pointer to a pointer, as they were back in the old 680x0 (and I think even PPC) Mac days.They did this to allow memory block relocation without the program having to know anything happened (except that you had to lock the pointer to access it).As you can see, the term is rather broad.   