Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

What stirs your rage, /prog/?

Name: Anonymous 2013-09-14 1:07

Mine are people who do this on C-like languages:
if(numbers==NULL)
{
numbers=temp;
numbers->next=NULL;
}
else
{
temp2=numbers;
while(temp2!=NULL)
{
var=temp2;
temp2=temp2->next;
}
temp2=temp;
var->next=temp2;
temp2->next=NULL;
}


No spaces between operators.
Opening brace on lines by themselve.
Else statement not a continuation of the if-statement it belongs to
Terse variable.
camelCase

Name: Anonymous 2013-11-18 1:08

>>98
oh ok, so it's a priority queue that can fetch both the min and the max efficiently. The approach you described would work well. There's a similar approach for the purely functional double sided-queue, which can be implemented with two singly linked list, where one is the reverse of the other. Or am I thinking of zippers, which work kind of well. Nevermind. In some cases sorted lists work ok as priority queues. If the new priorities of inserted elements are close to one extreme in priority, and if changed priorities are known to not cross across too many other elements they can work. Or if the size of the queue just stays really small.

But back to the original discussion (which is less interesting imo) data structures have a natural hierarchal structure for documentation, where it is often sufficient to document it's interface and the invariants that are to be maintained by its methods. I don't agree that comments are never necessary, but they can be used more or less effectively and commented code doesn't always give you the information you need to understand it, or what invariants you need to maintain to keep correctness if you were to add onto it.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List