CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Managed C++ and C++/CLI Discuss Managed C++ and .NET-specific questions related to C++.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old July 8th, 2005, 12:12 AM
    codegurugeek codegurugeek is offline
    Member
     
    Join Date: Feb 2005
    Posts: 64
    codegurugeek is an unknown quantity at this point (<10)
    Weird void** ?

    Guys,

    i don't know what is the difference between "void**" and "void"??
    I even look through the msdn webside with that keyword.. but couldn't get any result...
    Can anyone explain to me ?
    Reply With Quote
      #2    
    Old July 8th, 2005, 12:42 AM
    SouthernCodeMonkey SouthernCodeMonkey is offline
    Member
     
    Join Date: Feb 2005
    Posts: 106
    SouthernCodeMonkey is on a distinguished road (40+)
    Re: Weird void** ?

    See MSDN:

    http://msdn.microsoft.com/library/de.../key_s-z_9.asp

    Regards.
    Reply With Quote
      #3    
    Old July 8th, 2005, 12:55 AM
    codegurugeek codegurugeek is offline
    Member
     
    Join Date: Feb 2005
    Posts: 64
    codegurugeek is an unknown quantity at this point (<10)
    Re: Weird void** ?

    alright.. base on the explanation from the msdn.. i understand that if

    void --> for function usage;
    void* --> universal pointer;
    void** --> ?

    is void ** = &(void*)??
    Reply With Quote
      #4    
    Old July 8th, 2005, 01:04 AM
    SouthernCodeMonkey SouthernCodeMonkey is offline
    Member
     
    Join Date: Feb 2005
    Posts: 106
    SouthernCodeMonkey is on a distinguished road (40+)
    Re: Weird void** ?

    Yes, void** is ptr to void ptr.
    Reply With Quote
      #5    
    Old July 8th, 2005, 06:49 AM
    NoHero's Avatar
    NoHero NoHero is offline
    Moderator
     
    Join Date: Mar 2004
    Location: (Upper-) Austria
    Posts: 2,899
    NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)
    Re: Weird void** ?

    void = Nothing. Not even for function declaration that do not return something...

    Code:
    // A function that has no arguments
    int main ( void )
    {
       return 0;
    }
    You can even cast something to void:

    Code:
    // Cast to void, to tell the compiler to make an optimation for not checking and/or storing the return value
    int main ( void )
    {
        (void)printf("Hello World\n");
        return 0;
    }
    void* ... Is an universal pointer that does not need casting in C but so in C++.
    void** ... A pointer to a pointer. (A string array for example). Since void is nothing special at all you cannot use the [] operators to declare an array of pointers. So void * narf[] is not allowed because it is of an unspecified type of size. But for example char* narf[] would be allowed because the size of char is specified. To avoid this problem you write void ** which would be the same as void *[] if it would be allowed.
    __________________
    I am not offering technical guidiance via email or IM
    Come on share your photo with us! CG members photo album!
    Use the Code Tags!
    Reply With Quote
      #6    
    Old July 16th, 2005, 05:13 AM
    codegurugeek codegurugeek is offline
    Member
     
    Join Date: Feb 2005
    Posts: 64
    codegurugeek is an unknown quantity at this point (<10)
    Unhappy Re: Weird void** ?

    Alright.. got it..

    However, why isnt the one below working?

    IGraphBuilder* igb;
    IMediaControl* imc;

    void* tempimc = imc;
    temphr = igb->QueryInterface(IID_IMediaControl,&tempimc);

    i am getting the annoying error
    Stating that i "can't convert * __gc* to void**"

    may i know what is the matter?
    Reply With Quote
      #7    
    Old July 16th, 2005, 07:02 AM
    NoHero's Avatar
    NoHero NoHero is offline
    Moderator
     
    Join Date: Mar 2004
    Location: (Upper-) Austria
    Posts: 2,899
    NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)
    Re: Weird void** ?

    Quote:
    Originally Posted by codegurugeek
    Code:
    IGraphBuilder* igb;
    IMediaControl* imc;
    
    void* tempimc = imc;
    temphr = igb->QueryInterface(IID_IMediaControl,&tempimc);
    The compiler thinks those two pointers are managed pointers, but are in fact only unmanaged COM pointers. Use __nogc to mark non-managed pointers.
    __________________
    I am not offering technical guidiance via email or IM
    Come on share your photo with us! CG members photo album!
    Use the Code Tags!
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Visual C++ & C++ Programming > Managed C++ and C++/CLI


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 05:24 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009