Opened 6 years ago

Closed 5 years ago

#7208 closed enhancement (wontfix)

API: Use of C++ namespaces instead of name prefixes

Reported by: blarg Owned by: blarg
Priority: low Milestone: closed_because_of_github_migration
Component: default Version: svn-trunk
Severity: minor Keywords: api
Cc: antonio

Description

In very many places, GDAL's C++ API doesn't use C++ namespaces; instead it uses name prefixes such as GDAL or OGR.

Is there a particular reason for this? The C++ language introduced namespaces for a multitude of apparently-good reasons.

The constant repetition of the all capitals name prefixes causes additional typing, it hurts my eyes because it's like the API is always SHOUTING AT ME, and it just feels so... C-ish and 1990s-ish.

Would a series of patches creating a GDAL namespace (and perhaps an OGR namespace too), containing de-prefixed typedefs for the non-namespaced, prefixed names, be accepted?

Ie:

namespace GDAL {
typedef ::GDALDataset Dataset;
}

The obvious intention would be to one day deprecate all of the non-namespaced, prefixed names.

Change History (7)

comment:1 by Even Rouault, 6 years ago

There are backwards implication in doing such changes. This should be discussed as a RFC, and probably for a GDAL 3.0

comment:2 by Even Rouault, 6 years ago

Keywords: api added
Summary: Use of C++ namespaces instead of name prefixesAPI: Use of C++ namespaces instead of name prefixes

comment:3 by antonio, 6 years ago

Cc: antonio added

comment:4 by blarg, 6 years ago

To be clear and explicit, the problem with this proposal is not backward compatibility - this change would not break anything.

The problem here is that there is only any point in doing such work, if the long-term intention of the GDAL project is to move away from C-style FOObar() name prefixes, and towards C++-style foo::bar namespaces.

Thus, I agree this should be an RFC (but I have no idea how to create one of those).

comment:5 by blarg, 6 years ago

Can someone please point me to documentation explaining how to create an RFC regarding this?

Also, can someone please give me an idea what there is to discuss?

comment:6 by Even Rouault, 6 years ago

Existing RFCs are listed at https://trac.osgeo.org/gdal/wiki/RfcList . You can have a look at the few last ones to see the topics usually covered

comment:7 by Even Rouault, 5 years ago

Milestone: closed_because_of_github_migration
Resolution: wontfix
Status: assignedclosed

This ticket has been automatically closed because Trac is no longer used for GDAL bug tracking, since the project has migrated to GitHub. If you believe this ticket is still valid, you may file it to https://github.com/OSGeo/gdal/issues if it is not already reported there.

Note: See TracTickets for help on using tickets.