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

    here is a scoop : The Visual C++ compiler also compiles C code ! ;P


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

    [VisualCalc 3.0][Flags Beginner's Guide]

    J Offline
    J Offline
    Jonathan Darka
    wrote on last edited by
    #6

    Here's another scoop. This is the C++/MFC board, C questions do not belong here. So it's irrelevant whether the VC++ compiler can compile C code. :-D


    Jonathan Wilkes Darka [Xanya.net]

    T 1 Reply Last reply
    0
    • J Jonathan Darka

      Here's another scoop. This is the C++/MFC board, C questions do not belong here. So it's irrelevant whether the VC++ compiler can compile C code. :-D


      Jonathan Wilkes Darka [Xanya.net]

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

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


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

      [VisualCalc 3.0][Flags Beginner's Guide]

      J R 2 Replies Last reply
      0
      • T toxcct

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


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

        [VisualCalc 3.0][Flags Beginner's Guide]

        J Offline
        J Offline
        Jonathan Darka
        wrote on last edited by
        #8

        I'd say the soapbox ;)


        Jonathan Wilkes Darka [Xanya.net]

        T 1 Reply Last reply
        0
        • T toxcct

          are you coding in C or C++ ?


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

          [VisualCalc 3.0][Flags Beginner's Guide]

          M Offline
          M Offline
          manu_2205
          wrote on last edited by
          #9

          ya coding in c++ VS2003.

          manu

          J T 2 Replies Last reply
          0
          • M manu_2205

            ya coding in c++ VS2003.

            manu

            J Offline
            J Offline
            jhwurmbach
            wrote on last edited by
            #10

            manu_2205 wrote:

            c++ VS2003

            Why on earth would you need calloc, then?


            "We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.

            D 1 Reply Last reply
            0
            • J Jonathan Darka

              I'd say the soapbox ;)


              Jonathan Wilkes Darka [Xanya.net]

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

              Jonathan [Darka] wrote:

              I'd say the soapbox

              The SoapBox is for VB... Sorry


              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

                ya coding in c++ VS2003.

                manu

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

                then what the hell is a calloc() call doing on a C++ code ? C++ deprecates the use of C memory management such as malloc, calloc, realloc and free. instead, you have to use new and delete, and you MUSTN'T miw the two ways together !!!


                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

                  P Offline
                  P Offline
                  prasad_som
                  wrote on last edited by
                  #13

                  Can you show code, that is failing ?

                  Prasad Notifier using ATL | Operator new[],delete[][^]

                  T 1 Reply Last reply
                  0
                  • P prasad_som

                    Can you show code, that is failing ?

                    Prasad Notifier using ATL | Operator new[],delete[][^]

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

                    [Message Deleted]

                    P M 2 Replies Last reply
                    0
                    • T toxcct

                      [Message Deleted]

                      P Offline
                      P Offline
                      prasad_som
                      wrote on last edited by
                      #15

                      toxcct wrote:

                      has nothing to do in a C++ code.

                      Yes, But interesting to see, why he is facing problem. Strange that people expect help without giving sufficient information.

                      Prasad Notifier using ATL | Operator new[],delete[][^]

                      1 Reply Last reply
                      0
                      • J jhwurmbach

                        manu_2205 wrote:

                        c++ VS2003

                        Why on earth would you need calloc, then?


                        "We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.

                        D Offline
                        D Offline
                        David Crow
                        wrote on last edited by
                        #16

                        It may be a legacy product that has been ported to the new compiler.


                        "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                        "Judge not by the eye but by the heart." - Native American Proverb

                        J 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

                          D Offline
                          D Offline
                          David Crow
                          wrote on last edited by
                          #17

                          There could be any nuber of reason why calloc() would fail. At the point of failure, what values are being passed to it?


                          "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                          "Judge not by the eye but by the heart." - Native American Proverb

                          1 Reply Last reply
                          0
                          • D David Crow

                            It may be a legacy product that has been ported to the new compiler.


                            "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                            "Judge not by the eye but by the heart." - Native American Proverb

                            J Offline
                            J Offline
                            jhwurmbach
                            wrote on last edited by
                            #18

                            DavidCrow wrote:

                            It may be a legacy product that has been ported to the new compiler.

                            He would have told us that, right?:suss: But then, if he would have been really interested in help, he would have given us enough information to help him!:rolleyes:


                            "We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.

                            D 1 Reply Last reply
                            0
                            • J jhwurmbach

                              DavidCrow wrote:

                              It may be a legacy product that has been ported to the new compiler.

                              He would have told us that, right?:suss: But then, if he would have been really interested in help, he would have given us enough information to help him!:rolleyes:


                              "We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation." -- Caius Petronius, Roman Consul, 66 A.D.

                              D Offline
                              D Offline
                              David Crow
                              wrote on last edited by
                              #19

                              jhwurmbach wrote:

                              He would have told us that, right?

                              Not necessarily.

                              jhwurmbach wrote:

                              But then, if he would have been really interested in help, he would have given us enough information to help him!

                              You are making assumptions. Plenty of folks may genuinely want help but may not know how to properly ask for it. The same can be said for folks that may genuinely want to provide help but may not know how to properly do it. ;)


                              "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                              "Judge not by the eye but by the heart." - Native American Proverb

                              1 Reply Last reply
                              0
                              • T toxcct

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


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

                                [VisualCalc 3.0][Flags Beginner's Guide]

                                R Offline
                                R Offline
                                Reagan Conservative
                                wrote on last edited by
                                #20

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

                                John P.

                                T 1 Reply Last reply
                                0
                                • 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