User Tools

Site Tools


Sidebar

projects

hfi0 (due 20200123)
wcp1 (due 20200123)
wpf1 (bonus; due 20200123)
wcp2 (due 20200129)
wpf2 (due 20200129)
wcp3 (due 20200205)
wpf3 (due 20200205)
wcp4 (due 20200212)
wpf4 (due 20200212)
wcp5 (due 20200226)
wpf5 (due 20200226)
bwp0 (due 20200226)
fom0 (ongoing)
eoce (due 20200513)
haas:spring2020:hpc0:projects:faq

FAQ

doubly-linked

list displays fine forward but not in reverse

This typically means you neglected to properly hook up a prior pointer, but were successful with all the after pointers.

unit test fails when "checking list integrity"

With many of these tests, I simply have the list displayed in reverse, so if problems occur there, see “list displays fine forward but not in reverse”

pointer contains conspicuously low address

Any pointer assigned to allocated memory should be some large unrecognizable value. If you notice (especially after calling something like mknode()) an address that is rather low, such as: 0x0100, make sure you didn't assign your pointer incorrectly.

For example, this will result in the above-mentioned scenario:

(*copiedNode) = (Node *) mknode (copiedNode, oldNode -> VALUE);

Casual glances may trick you into thinking that is a call to malloc(), but it is not… it is to mknode(), and remember, the doubly-linked functions return a code_t (an unsigned long long int) to the set status codes as a result of performing that operation.

The pointer left in this state will neither be NULL, nor pointing to accessible memory (the operating system is likely controlling memory that low in address space), so none of your checks for NULL will catch the segmentation fault that will likely manifest in short order.

You'd want something like:

code_t  result;
...
result = mknode(copiedNode, oldNode -> VALUE);
haas/spring2020/hpc0/projects/faq.txt · Last modified: 2015/11/06 13:15 by 127.0.0.1