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. Basic question on Pointers!!

Basic question on Pointers!!

Scheduled Pinned Locked Moved C / C++ / MFC
questionperformance
3 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.
  • I Offline
    I Offline
    Ilamparithi
    wrote on last edited by
    #1

    Hi, Whenever a pointer is not allocated, something like this, CClass *myObj; It is pointing to some address like 0xccddff. I know that the address is junk. Why it is always like 0xccdeff or 0xdeffcc?? Why it is not like 0x102033?? So, before allocation of memory it is pointing to some place, which is junk. But, where is that junk area? or which is the area used where the not allocated pointer points to? Best Regards, A.Ilamparithi

    J T 2 Replies Last reply
    0
    • I Ilamparithi

      Hi, Whenever a pointer is not allocated, something like this, CClass *myObj; It is pointing to some address like 0xccddff. I know that the address is junk. Why it is always like 0xccdeff or 0xdeffcc?? Why it is not like 0x102033?? So, before allocation of memory it is pointing to some place, which is junk. But, where is that junk area? or which is the area used where the not allocated pointer points to? Best Regards, A.Ilamparithi

      J Offline
      J Offline
      jmkhael
      wrote on last edited by
      #2

      Check http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvs600/html/debugging.asp[^] Search for No man's land and look to the table (reading the article will do good too) Papa while (TRUE) Papa.WillLove ( Bebe ) ;

      1 Reply Last reply
      0
      • I Ilamparithi

        Hi, Whenever a pointer is not allocated, something like this, CClass *myObj; It is pointing to some address like 0xccddff. I know that the address is junk. Why it is always like 0xccdeff or 0xdeffcc?? Why it is not like 0x102033?? So, before allocation of memory it is pointing to some place, which is junk. But, where is that junk area? or which is the area used where the not allocated pointer points to? Best Regards, A.Ilamparithi

        T Offline
        T Offline
        Taka Muraoka
        wrote on last edited by
        #3

        The compiler sets this up for you (in debug builds only) so that you can find bugs quickly if you accidentally use the pointer without initializing it. It also does a similar thing with dynamically allocated blocks of memory.


        Lets be honest, isn't it amazing how many truly stupid people you meet during the course of the day. Carry around a pad and pencil, you'll have twenty or thirty names by the end of the day - George Carlin Awasu 1.1.4 [^]: A free RSS reader with support for Code Project.

        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