[GRASS-dev] Compiling r.viewshed and r.terraflow with C++11

Vaclav Petras wenzeslaus at gmail.com
Tue Dec 10 09:08:08 PST 2013

On Tue, Dec 10, 2013 at 5:41 AM, Glynn Clements <glynn at gclements.plus.com>wrote:

> Vaclav Petras wrote:
> > So my question is, was this fixed in the time of [1]? It is not clear
> from
> > the discussion.
> No.
> > If not, what is the right fix?
> The right fix is to remove all occurrences of "using namespace std;",
> then fix the (probably hundreds) of errors which arise, either by
> using qualified names (e.g. std::vector) or by adding "using"
> statements for individual names (e.g. "using std::vector;").
> I tried to delete all "using namespace std;" but the error "
reference...ambiguous" was still there in slightly different form
(unfortunately I lost them, so I cannot cite them). I decided that I will
rename the functions in r58434. It seemed better than putting them into
namespace because the namespace would be just for those particular
functions or it would cause a lot of changes or "using yyy::xxx;" if it
would be applied to more functions/classes.

[r58434] https://trac.osgeo.org/grass/changeset/58434

[Note that iostream uses templates, so it might matter which approach
> is taken. A qualified name forces the use of a specific function (or
> type, etc), whereas a "using" statement adds the name as a fallback
> but argument-dependent lookup takes priority.]
> I was afraid that removing of overloading will cause some problems but it
compiles, runs and results seems ok (but I actually don't know what to test
except for the example in manual).

> A more comprehensive fix would be to simply not accept code written in
> C++. It's a deceptively complex language, and writing portable C++
> code is significantly harder than writing "works-on-my-system" code.
> Consequently, a very large proportion of C++ code falls into the
> latter category.
> That isn't a problem if you're writing something for your personal use
> and you're willing to abandon it once it no longer compiles on current
> systems. OTOH, it is a problem for a project like GRASS, which aims to
> support multiple platforms over the long term.
> If you think that this is an issue it should be discussed and resulting
policy should go to submitting rules.

> Glynn Clements <glynn at gclements.plus.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20131210/cee4d18c/attachment-0001.html>

More information about the grass-dev mailing list