realloc problem, corrupt last item

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Eligiusz Narutowicz

    #16
    Re: realloc problem, corrupt last item

    Antoninus Twink <nospam@nospam. invalidwrites:
    On 9 May 2008 at 5:32, Richard Heathfield wrote:
    >The OP replied to the above, quoting a little of it, and then Chuck replied
    >to that reply:
    >>>
    >> if (tmp = realloc(bp, sizeof book) bp = tmp; /* ok, update */
    >> else {
    >> /* tmp == NULL, realloc failed, do whatever is needed */
    >> /* Note that the original content of *bp still exists */
    >> }
    >>
    >I'm curious to know what information Chuck thinks he added here.
    >
    He added a syntax error in the if line, and gave the OP an example of
    hideous C style: his idiotic inistence on one-line if statements that
    makes code hard-to-read and debugging even harder, plus a completely
    vacuous comment.
    Does he really help people? But I must be in agreement with you that
    this style would not be allowed on my projects. It is horrible and very
    amateur. Possibly Chuck is a new C programmer and learning though it is
    better to be patient.

    Comment

    Working...