Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Why is pointer a compound type, not a fundamental type?

Why is pointer a compound type, not a fundamental type?

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 3 Posters 0 Views 1 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.
  • S Offline
    S Offline
    sawerr
    wrote on last edited by
    #1

    Compound types, by definition, are types that are derived from other basic types. Right? In my opinion, pointers, with their unique representation( * and &), must be classificated as a fundamental type. Am I wrong?

    L _ 3 Replies Last reply
    0
    • S sawerr

      Compound types, by definition, are types that are derived from other basic types. Right? In my opinion, pointers, with their unique representation( * and &), must be classificated as a fundamental type. Am I wrong?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      sawerr wrote:

      Compound types, by definition

      Interestingly, Bjarne Stroustrup does not provide a definition in his glossary of C++[^].

      speaking as ...

      1 Reply Last reply
      0
      • S sawerr

        Compound types, by definition, are types that are derived from other basic types. Right? In my opinion, pointers, with their unique representation( * and &), must be classificated as a fundamental type. Am I wrong?

        _ Offline
        _ Offline
        _Superman_
        wrote on last edited by
        #3

        A pointer is not a type. Otherwise you would be able to create it this way - * p;

        «_Superman_»  _I love work. It gives me something to do between weekends.

        _Microsoft MVP (Visual C++)

        Polymorphism in C

        1 Reply Last reply
        0
        • S sawerr

          Compound types, by definition, are types that are derived from other basic types. Right? In my opinion, pointers, with their unique representation( * and &), must be classificated as a fundamental type. Am I wrong?

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Since a pointer is a memory address its type if you lie is actually its size, and hence is the same as the bit ness of the OS, 32 or 64, 4 or 8. However, and this is where it gets interesting, when you increment a pointer the address increases by the size of the declared type. So a char pointer goes up by one byte, a DWORD pointer by 4 and so on.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups