Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!.POSTED!not-for-mail From: =?UTF-8?B?RGFuaWVsIEtyw7xnbGVy?= Newsgroups: comp.std.c++ Subject: Re: Defect Report: Attitude to overloaded comma for iterators Date: Thu, 9 Feb 2012 10:07:44 -0800 (PST) Organization: A noiseless patient Spider Lines: 50 Sender: std-cpp-request@vandevoorde.com Approved: stephen.clamage@oracle.com Message-ID: <4F33C66B.1050801@googlemail.com> References: <2ad44743-d84f-41f0-9d69-5a3505c76430@dp8g2000vbb.googlegroups.com> NNTP-Posting-Host: z4Wz9+22juzfSpojToHnrKN0sZeZDO6YJe9u1feVd+M= Content-Type: text/plain; charset=UTF-8; format=flowed X-Trace: news.albasani.net HsnW2WLt26uPf4xSPn/oKymMHR6xGNjTsC6Xa60JTXelMCuV6/27e5Of+QOoVFkl+a7pTREuwIDukPi6hLjD2g== X-Complaints-To: abuse@albasani.net NNTP-Posting-Date: Thu, 9 Feb 2012 18:10:22 +0000 (UTC) X-Mailer: Perl5 Mail::Internet v2.05 X-Submission-Address: std-cpp-submit@vandevoorde.com Cancel-Lock: sha1:Bn1WTFn5ZMahTVTda6xXbKHK8Cc= X-Original-Date: Thu, 09 Feb 2012 14:13:15 +0100 Xref: x330-a1.tempe.blueboxinc.net comp.std.c++:416 On 2012-01-25 08:30, Yakov Galka wrote: > [global.functions] says: > >> Unless otherwise specified, global and non-member functions in the standard library shall not use functions from another namespace which are found through argument-dependent name lookup (3.4.2). > > This sounds clear enough. There are just two problems: > > 1. Both implementations I tested (VS2005 and GCC 3.4.3) do unqualified > calls to the comma operator in some parts of the library with operands > of user-defined types. > > 2. The standard itself does this in the description of some > algorithms. E.g. uninitialized_copy is defined as: > >> Effects: >> for (; first != last; ++result, ++first) >> ::new (static_cast(&*result)) >> typename iterator_traits::value_type(*first); > > If understood literally, it is required to call operator, > (ForwardIterator, InputIterator). > > For detailed discussion with code samples see > http://stackoverflow.com/questions/8719829/should-the-implementation-guard-itself-against-comma-overloading. > > Proposal: > > 1. Add an exception to the rule in [global.functions] by permitting > the implementation to call the comma operator as much as it wants to. � > I doubt we want this. or > > 2. Fix the description of the said algorithms and perhaps add a note > to [global.functions] that brings attention of the implementers to > avoid this pitfall. > > Sincerely > Yakov Galka This issue has been forwarded to the LWG working group. Greetings from Bremen, Daniel Krügler -- [ comp.std.c++ is moderated. To submit articles, try posting with your ] [ newsreader. If that fails, use mailto:std-cpp-submit@vandevoorde.com ] [ --- Please see the FAQ before posting. --- ] [ FAQ: http://www.comeaucomputing.com/csc/faq.html ]