FAQ
The Node type in this example is just a dummy, it's going to get replaced
by something much larger.


On Mon, Dec 23, 2013 at 8:07 PM, Jesse McNelis wrote:
On Tue, Dec 24, 2013 at 11:52 AM, Rasmus Schultz wrote:

So my only options are, change the method signature to return *Node, which I don't want, for the reasons you explained - or construct and return a "dummy" Node instance whenever there's nothing to return? That seems awfully wasteful.

From you're previous queue thread I assume Node is
type Node struct {
Value int
}

Which is the same size as the nil pointer you'd be returning anyway.
Copying 8 bytes of zeros to the stack is an immeasurably tiny amount of
work.


--
=====================
http://jessta.id.au
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

People

Translate

site design / logo © 2022 Grokbase