Talk:FIFO (computing and electronics): Difference between revisions

Content deleted Content added
Name move
m Task 70: Update syntaxhighlight tags - remove use of deprecated <source> tags
Line 39:
== The code fragment is buggy ==
 
Try a simple thought experiment: <sourcesyntaxhighlight lang=cpp>queue(1);
item = dequeue();</sourcesyntaxhighlight>
The front and back pointers are not connected by the queue and dequeue functions, so the sequence won't work as expected.
 
A possible fixed version of the functions:
<sourcesyntaxhighlight lang=cpp>
fifo_node *dequeue(void)
{
Line 66:
}
}
</syntaxhighlight>
</source>
 
Note that this code is twice as long! The whole class would cover a full screen. I'm not sure such a queue implementation would fit into the article...