 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Vladimir Marko Guest
|
Posted: Fri May 27, 2005 5:23 pm Post subject: names _1, _2, etc. in global namespace (unreserve?) |
|
|
Considering the placeholders _1, _2, etc. from Boost.Bind and
Boost.Lambda (and std::placeholders from N1455) there is an issue
with reserved names:
17.4.3.1.2/1 2nd bullet:
Each name that begins with an underscore is reserved to the
implementation for use as a name in the global namespace.
This makes the use of placeholders through a using-directive or
using-declaration little dangerous. Though I've never heard of an
implementation that would use global names _1, _2, etc. these names
are officialy reserved and the following snippet may be ill-formed:
namespace test{
struct arg1 { } _1;
}
using namespace test;
int main(){
_1; // may be ambigous if the implementation defines _1 in global
// namespace
}
I suspect that many users actualy use the placeholders in a similar
way. So it may be reasonable to explicitly remove these identifiers
from reserved names. This would "legalize" the existing practice.
But which names should be unreserved then? All names with a leading
underscore followed by a digit or just names composed exclusively
of a leading underscore and a number?
Regards,
Vladimir Marko
---
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.edu ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|