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. calloc()

calloc()

Scheduled Pinned Locked Moved C / C++ / MFC
23 Posts 10 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.
  • T toxcct

    [Message Deleted]

    M Offline
    M Offline
    Maximilien
    wrote on last edited by
    #21

    Sometimes I wonder why you are a CP MVP. I work with a large amount of legacy C code that use malloc/calloc/realloc/free I cannot, will not change that because it works and has been working for the last few years. The question is valid, albeit not well "asked", in this forum.


    Maximilien Lincourt Your Head A Splode - Strong Bad

    1 Reply Last reply
    0
    • R Reagan Conservative

      There is such a place: http//cboard.cprogramming.com --- Purely 'C'.

      John P.

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #22

      toxcct wrote:

      ok, and tell me where you ask C question on CP elsewhere that this board ?

      CP means Codeproject.


      Don't know where to start ?
      Refer the Forums Guidelines and ask a friend

      [VisualCalc 3.0][Flags Beginner's Guide]

      1 Reply Last reply
      0
      • M manu_2205

        Hi I have used many times calloc().But this time it is going fail. What may be the reason when calloc() fails(return bad pointer) Thanx

        manu

        J Offline
        J Offline
        James R Twine
        wrote on last edited by
        #23

        If it returns NULL, it is a failure, like an out-of-memory or out-of-address-space condition.  If it returns a non-NULL value, but things crash when you try to use it (i.e. it is truly invalid), then I would offer that the heap information used by calloc(...) is messed up,or you are going too far with the pointer returned.    Although, since calloc(...) has to actually touch the memory to initialize it to zero, it should crash within the call to calloc(...) if the memory it allocated is really invalid.    So, what do you mean by "returns bad pointer"?    Peace!

        -=- James
        Please rate this message - let me know if I helped or not! * * * If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
        Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
        See DeleteFXPFiles

        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