COIN-OR::LEMON - Graph Library

Opened 11 years ago

Closed 11 years ago

#122 closed task (fixed)

'Node' or 'const Node&' parameters

Reported by: Peter Kovacs Owned by: Alpar Juttner
Priority: minor Milestone:
Component: core Version:
Keywords: Cc:
Revision id:

Description

Which syntax should be used if a function needs a node/arc/edge parameter? Which one is better and why?

  • Node n, Arc a, Edge e
  • const Node &n, const Arc &a, const Edge &e

Change History (5)

comment:1 in reply to:  description ; Changed 11 years ago by Alpar Juttner

Replying to kpeter:

Which syntax should be used if a function needs a node/arc/edge parameter? Which one is better and why?

  • Node n, Arc a, Edge e
  • const Node &n, const Arc &a, const Edge &e

Probably they are equally good in virtually all cases.

comment:2 Changed 11 years ago by Alpar Juttner

Probably it is better to raise a topic like this on the mailing list first.

comment:3 in reply to:  2 Changed 11 years ago by Peter Kovacs

Replying to alpar:

Probably it is better to raise a topic like this on the mailing list first.

See comment:ticket:123:5.

comment:4 in reply to:  1 ; Changed 11 years ago by Peter Kovacs

Replying to alpar:

Probably they are equally good in virtually all cases.

Of course, the first form allows changing the parameter values, while the second one doesn't.

If there isn't any efficiency difference, this question is not important, and this ticket can be closed.

comment:5 in reply to:  4 Changed 11 years ago by Alpar Juttner

Resolution: fixed
Status: newclosed

Replying to kpeter:

If there isn't any efficiency difference,

Hopefully there isn't. At least for inline functions there shouln't be.

I think it is rather a matter of programming style. It would be nice if we followed a uniform style in this question, but not really a problem if we do not.

this question is not important, and this ticket can be closed.

I do so.

Note: See TracTickets for help on using tickets.