Mir

mir_toolkit namespace around client API functions is pointless

Bug #1137184 reported by Daniel van Vugt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mir
Fix Released
Undecided
Alan Griffiths

Bug Description

Recently the mir_toolkit namespace was added and it was applied to client API functions too:

    src/client/mir_client_library.cpp:
    mir_toolkit::MirWaitHandle* mir_toolkit::mir_connect(...

Although the client header says 'extern "C"' so the namespace is not emitted in the compiled output:

    nm lib/libmirclient.so.0 | grep 'T mir_'
    0000000000030840 T mir_connect

This means all the messiness of mentioning "mir_toolkit::" in mir_client_library.cpp appears to be pointless. And it has also caused bug 1137170 too.

Related branches

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

It is not pointless - it just doesn't change the linkage.

It permits C++ code to refer to use the namespace for disambiguation, and it cleanly separates the API in the generated Docygen docs.

Revision history for this message
Daniel van Vugt (vanvugt) wrote :

I still don't see the use.

The client identifiers are clearly namespaced (C-style) by the "mir_" prefix already. Hence they're already unambiguous.

It's just a matter of risk. You're solving a problem that will probably never exist. That is someone defines a "mir_connect" elsewhere. And the trade-off is that the code is made uglier for this highly unlikely situation.

Taking it to an extreme, someone could still come along and define:
    somethingelse::mir_toolkit::mir_connect
albeit even less likely than the previous case. We're talking about highly unlikely vs exceedingly unlikely. So I would prefer to err on the side of code cleanliness.

Changed in mir:
assignee: Alan Griffiths (alan-griffiths) → nobody
information type: Proprietary → Public
Robert Carr (robertcarr)
Changed in mir:
status: New → Fix Committed
Changed in mir:
assignee: nobody → Alan Griffiths (alan-griffiths)
Changed in mir:
milestone: none → 0.0.3
Changed in mir:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.