Thread: About pointer

  1. #1
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008

    Thumbs down About pointer

    I read many articles which published by anti-C programmers...

    They said, "pointers are dangerous"

    Do you have any comments about this?

  2. #2
    Registered User
    Join Date
    Jul 2008
    They obviously don't understand the point behind pointers...
    My stand is that if your Anti C you've along way to go

  3. #3
    Kernel hacker
    Join Date
    Jul 2007
    Farncombe, Surrey, England
    Pointers can be dangerous in the same way that a sharp tool can be dangerous: They provide the potential to do harm to yourself.

    Typically, misuse of pointers include:
    • Writing beyond the range of memory the pointer was intended to be used at (e.g. allocate 10 bytes, or point to a string of 10 characters and write to bytes 11 or more).
    • Using pointers that don't point to valid memory by not setting the pointer (e.g calling malloc or taking an address of something).
    • Not freeing memory which is no longer used.
    • Using pointers that have actually been freed.

    But just like a knife, chisel or axe, they also provide great tools that can do good work when used correctly.

    The people who complain about pointers being dangerous are usually coming from languages that don't have pointers - so they don't understand pointers.

    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Following CTools
    By EstateMatt in forum C Programming
    Replies: 5
    Last Post: 06-26-2008, 10:10 AM
  2. Quick Pointer Question
    By gwarf420 in forum C Programming
    Replies: 15
    Last Post: 06-01-2008, 03:47 PM
  3. Parameter passing with pointer to pointer
    By notsure in forum C++ Programming
    Replies: 15
    Last Post: 08-12-2006, 07:12 AM
  4. Direct3D problem
    By cboard_member in forum Game Programming
    Replies: 10
    Last Post: 04-09-2006, 03:36 AM
  5. Struct *** initialization
    By Saravanan in forum C Programming
    Replies: 20
    Last Post: 10-09-2003, 12:04 PM

Tags for this Thread