15 lines
392 B
Plaintext
15 lines
392 B
Plaintext
![]() |
In {cpp}, it is preferred to use reference parameters (`Type const&` or `Type&`), or pass objects by value (`Type`), instead of a pointer (`Type const*` or `Type*`), if the argument is expected to never be null.
|
||
|
|
||
|
[source,cpp]
|
||
|
----
|
||
|
// Precondition: graph != null
|
||
|
bool isDAG(Graph const* graph);
|
||
|
----
|
||
|
|
||
|
The preferred signature would be:
|
||
|
|
||
|
[source,cpp]
|
||
|
----
|
||
|
bool isDAG(Graph const& graph);
|
||
|
----
|