(void **)

This is a discussion on (void **) within the C++ Programming forums, part of the General Programming Boards category; What does it mean ? void *somevar would declare a pointer without a specific target type, but what does void ...

  1. #1
    *******argv[] - hu? darksaidin's Avatar
    Join Date
    Jul 2003
    Posts
    314

    (void **)

    What does it mean ? void *somevar would declare a pointer without a specific target type, but what does void ** mean ? Pointer to a pointer ? An array of pointer ?

    I tried to search for void** but unfortunatly the * is a wildcard so the board came up with like 300 pages of topics...

    Can anyone help me?

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297

    Re: (void **)

    Originally posted by darksaidin
    Pointer to a pointer ? An array of pointer ?
    yes
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    *******argv[] - hu? darksaidin's Avatar
    Join Date
    Jul 2003
    Posts
    314

    Re: Re: (void **)

    Originally posted by FillYourBrain
    yes
    yes what ? which of it ? and how ?

  4. #4
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    both could be correct.

    pointer: a type * is a pointer to a type. if "type *" is a type called type2 then type2 * is a pointer to it. since type2 is a type *, type2 * is equal to type **.

    array: a pointer to anything can be an array of that type. therefore a pointer to a void pointer could be an array of void pointers.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  5. #5
    *******argv[] - hu? darksaidin's Avatar
    Join Date
    Jul 2003
    Posts
    314
    Originally posted by FillYourBrain
    both could be correct.

    pointer: a type * is a pointer to a type. if "type *" is a type called type2 then type2 * is a pointer to it. since type2 is a type *, type2 * is equal to type **.

    array: a pointer to anything can be an array of that type. therefore a pointer to a void pointer could be an array of void pointers.
    Thanks for your reply fib.
    That makes sense.
    I don't understand it.

    If it's in a parameterlist, can I assume that I am required to specify an array of pointers ? Is this because you can't use arrays in parameters, so I have to specify a pointer to the array instead ? Why does it all have to be that complicated ? ouh

  6. #6
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    its in a parameter list? what do you mean? if you're trying to figure out what you're supposed to pass in, you're best bet is the documentation . Otherwise, is it a windows API? in windows, void * is often a handle of some type. What exactly are you trying to figure out.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  7. #7
    *******argv[] - hu? darksaidin's Avatar
    Join Date
    Jul 2003
    Posts
    314
    Originally posted by FillYourBrain
    its in a parameter list? what do you mean? if you're trying to figure out what you're supposed to pass in, you're best bet is the documentation . Otherwise, is it a windows API? in windows, void * is often a handle of some type. What exactly are you trying to figure out.
    mhm, well, err... it's an OpenGL function but I wanted to ask what void ** means in general, not only limited to the function (because I've seen it in other places before) - thats why I posted it here instead of in game programming. (Valid excuse ? )

    Anyway, the function is...

    Code:
        void glMultiDrawElementsEXT( GLenum mode,
    				 GLsizei *count,
    				 GLenum type,
    				 const GLvoid **indices,
    				 GLsizei primcount)
    ... and now after you explained what void ** means, I think it wants me to specify...

    glMultiDrawElementsEXT( "drawmode", "address of my integer array with the vertex counts", "type of the indices", "address of my array of pointers that point to the vertices to be drawn", "size of *count or count[] and *indices[] which resolves to the number of primitives to be drawn").

    If thats not right I'll probably end up with hundreds of megs of garbage in my memory - but I think it is. Thanks for filling my brain

  8. #8
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    yeah, it appears to be a list of separately allocated arrays. since it is void, I have no idea what they are really arrays of (aside from the description "vertices"). Documentation ought to tell you that. Part of the glory and awkwardness of void * is that it is generic and there's no telling what's in there.
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Another syntax error
    By caldeira in forum C Programming
    Replies: 31
    Last Post: 09-05-2008, 01:01 AM
  2. Replies: 3
    Last Post: 05-13-2007, 08:55 AM
  3. game window rejected painting !
    By black in forum Windows Programming
    Replies: 4
    Last Post: 03-27-2007, 01:10 AM
  4. msvc just ate one of my source files
    By Eber Kain in forum C++ Programming
    Replies: 6
    Last Post: 07-01-2004, 05:40 AM
  5. Half-life SDK, where are the constants?
    By bennyandthejets in forum Game Programming
    Replies: 29
    Last Post: 08-25-2003, 11:58 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21