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. Pointer mess

Pointer mess

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
4 Posts 4 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.
  • E Offline
    E Offline
    Elsie
    wrote on last edited by
    #1

    If my pointer is pointing an invalid object. How to find proactively in run-time.

    K M _ 3 Replies Last reply
    0
    • E Elsie

      If my pointer is pointing an invalid object. How to find proactively in run-time.

      K Offline
      K Offline
      KarstenK
      wrote on last edited by
      #2

      there are some memory check functions as _CrtIsValidPointer() It is strongly recommanded to avoid this situation. use pointers to data, only for copying the data, if you need it later. -> make your own object   :-O

      Press F1 for help or google it. Greetings from Germany

      1 Reply Last reply
      0
      • E Elsie

        If my pointer is pointing an invalid object. How to find proactively in run-time.

        M Offline
        M Offline
        Mahesh Kulkarni
        wrote on last edited by
        #3

        To check the validity of the pointer in Windows there are API functions called IsBadReadPtr and IsBadWritePtr to do that. P.S. While using pointer developer should be careful that pointer is set to NULL once it is deleted. And not to use the deleted pointer before allocating memory.

        The secret of life is not enjoyment but education through experience. - Swami Vivekananda.

        1 Reply Last reply
        0
        • E Elsie

          If my pointer is pointing an invalid object. How to find proactively in run-time.

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

          There is no reasonable and fool proof way to make this check. You as a programmer must ensure that this never happens. Smart pointers can help you to an extent.

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

          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