Timeline for Implementing a generic Queue in C
Current License: CC BY-SA 3.0
7 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Sep 14, 2016 at 11:48 | comment | added | chux |
@Luis Averhoff Per #12, recommending memset(newNode, 0, sizeof *NewNode); free(newNode); to zero the referenced data pointed to by newNode before free() .
|
|
Sep 14, 2016 at 11:45 | comment | added | chux |
@Luis Averhoff The .h file should contain #include <stdlib.h> . Your commented problem is precisely why #include "Queue.h" should be first (#10) as it detected that - but IMO, your fix was wrong.
|
|
Sep 14, 2016 at 0:18 | comment | added | Luis Averhoff | In regards to number 10, I have to use Queue.h after the stdlib.h else it wont recognize any variable in my header file that have the type size_t. Could you elaborate on 12 with an example? What do you mean by zero filling memory before free? Like setting the pointer to NULL before calling free? | |
Sep 13, 2016 at 20:06 | history | edited | chux | CC BY-SA 3.0 |
deleted 33 characters in body
|
Sep 13, 2016 at 19:53 | history | edited | chux | CC BY-SA 3.0 |
added 384 characters in body
|
Sep 13, 2016 at 19:46 | comment | added | chux | See this comment for an idea to avoid the second level allocation when the size of data will fit in a pointer. | |
Sep 13, 2016 at 19:31 | history | answered | chux | CC BY-SA 3.0 |