Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. when to use below type of macro ?
Forum Updated to NodeBB v4.3 + New Features

when to use below type of macro ?

Scheduled Pinned Locked Moved Solved C++ Gurus
5 Posts 4 Posters 628 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q Offline
    Q Offline
    Qt embedded developer
    wrote on last edited by
    #1

    I want to know when to use below type of macro ? i want to understand this macro also.

    what is application of it ?

    #define NULL_PTR ((void *) 0L)
    
    Christian EhrlicherC Chris KawaC M 3 Replies Last reply
    0
    • Q Qt embedded developer

      I want to know when to use below type of macro ? i want to understand this macro also.

      what is application of it ?

      #define NULL_PTR ((void *) 0L)
      
      Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #4

      @Qt-embedded-developer said:

      I want to know when to use below type of macro ?

      Almost never. It's obsolete. Maybe if you're writing some retro-code for an ancient compiler as a hobby, but that's it. Not in any modern code.

      i want to understand this macro also.

      It creates a pointer to void with a value of 0. C++11 introduced nullptr to do the same without hacking the type system.

      what is application of it ?

      Currently none. It's obsolete. It was used to have a pointer type with a value of 0. Now you have nullptr.

      1 Reply Last reply
      3
      • Q Qt embedded developer

        I want to know when to use below type of macro ? i want to understand this macro also.

        what is application of it ?

        #define NULL_PTR ((void *) 0L)
        
        Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #2

        This is no longer needed since all compilers supported by Qt support c++11 and therefore the 'nullptr' keyword. I'm pretty sure it's no longer available in Qt6.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        Q 1 Reply Last reply
        3
        • Christian EhrlicherC Christian Ehrlicher

          This is no longer needed since all compilers supported by Qt support c++11 and therefore the 'nullptr' keyword. I'm pretty sure it's no longer available in Qt6.

          Q Offline
          Q Offline
          Qt embedded developer
          wrote on last edited by
          #3

          @Christian-Ehrlicher dear this doesn't matter can you tell me what i mentioned in post?

          1 Reply Last reply
          0
          • Q Qt embedded developer

            I want to know when to use below type of macro ? i want to understand this macro also.

            what is application of it ?

            #define NULL_PTR ((void *) 0L)
            
            Chris KawaC Offline
            Chris KawaC Offline
            Chris Kawa
            Lifetime Qt Champion
            wrote on last edited by
            #4

            @Qt-embedded-developer said:

            I want to know when to use below type of macro ?

            Almost never. It's obsolete. Maybe if you're writing some retro-code for an ancient compiler as a hobby, but that's it. Not in any modern code.

            i want to understand this macro also.

            It creates a pointer to void with a value of 0. C++11 introduced nullptr to do the same without hacking the type system.

            what is application of it ?

            Currently none. It's obsolete. It was used to have a pointer type with a value of 0. Now you have nullptr.

            1 Reply Last reply
            3
            • Q Qt embedded developer

              I want to know when to use below type of macro ? i want to understand this macro also.

              what is application of it ?

              #define NULL_PTR ((void *) 0L)
              
              M Offline
              M Offline
              mpergand
              wrote on last edited by
              #5

              @Qt-embedded-developer said in when to use below type of macro ?:

              #define NULL_PTR ((void *) 0L)

              In C, the macro NULL may have the type void*, but that is not allowed in C++.

              see: https://en.cppreference.com/w/cpp/types/NULL

              1 Reply Last reply
              2
              • Q Qt embedded developer has marked this topic as solved on

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved