stdcxx-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Sebor <se...@roguewave.com>
Subject Re: svn commit: r662518 - in /stdcxx/branches/4.2.x: tests/containers/23.bitset.cpp tests/containers/23.vector.cons.cpp tests/self/0.printf.cpp tests/support/18.exception.cpp util/collate.cpp util/scanner.cpp
Date Tue, 03 Jun 2008 15:43:18 GMT
Eric Lemings wrote:
>  
> 
>> -----Original Message-----
>> From: Martin Sebor [mailto:msebor@gmail.com] On Behalf Of Martin Sebor
>> Sent: Monday, June 02, 2008 5:38 PM
>> To: dev@stdcxx.apache.org
>> Subject: Re: svn commit: r662518 - in /stdcxx/branches/4.2.x: 
>> tests/containers/23.bitset.cpp 
>> tests/containers/23.vector.cons.cpp tests/self/0.printf.cpp 
>> tests/support/18.exception.cpp util/collate.cpp util/scanner.cpp
>>
>> elemings@apache.org wrote:
>>> Author: elemings
>>> Date: Mon Jun  2 11:59:24 2008
>>> New Revision: 662518
>>>
>>> URL: http://svn.apache.org/viewvc?rev=662518&view=rev
>>> Log:
>>> 2008-06-02  Eric Lemings <eric.lemings@roguewave.com>
>>>
>> [...]
>>> Modified: stdcxx/branches/4.2.x/tests/containers/23.vector.cons.cpp
>>> URL: 
>> http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/conta
>> iners/23.vector.cons.cpp?rev=662518&r1=662517&r2=662518&view=diff
>> ==============================================================
>> ================
>>> --- 
>> stdcxx/branches/4.2.x/tests/containers/23.vector.cons.cpp (original)
>>> +++ 
>> stdcxx/branches/4.2.x/tests/containers/23.vector.cons.cpp Mon 
>> Jun  2 11:59:24 2008
>>> @@ -618,7 +618,7 @@
>>>          for (typename Vector::size_type i = 0; i != 
>> rw_opt_nloops; ++i) {
>>>  
>>>              // construct an element at then end of array
>>> -            alloc.construct (vals + i, i);
>>> +            alloc.construct (vals + i, typename 
>> Alloc::value_type (i));
>>
>> For simplicity (and to avoid running into compiler bugs) I suggest
>> replacing the typename with:
>>
>>      alloc.construct (vals + i, T (i))
>>
> 
> Yep, that would be somewhat better.  Those two types are the same
> I assume, right?

Yes. Strictly speaking, the template parameter T is redundant. It's
there to avoid having to spell it "typename Alloc::value_type" and
running into compiler bugs.

> 
[...]
>> The reference to size_t should be qualified with std:: here. I was
>> about to recommend compiling with EDG eccp again to detect the absence
>> of the qualification but it appears that #including <sys/resource.h>
>> on Linux brings size_t into file scope so compiling with the front
>> end there doesn't reveal the problem. Ditto for Sun C++ on Solaris
>> whose C++ C headers are similarly strict.
> 
> Yeah, I used the rest of the file as a guide.  Some files qualify it,
> some don't.  I just followed suit.

Here's the convention:

Tests, examples, and utilities (except for exec) should be using
the new C++ C headers and qualifying all names with std:: (unless
there's a documented reason not to). Those that don't ought to be
changed because the lack of the qualification is most likely a bug.

Library headers avoid #including any C library headers (with the
exception of rw/_traits.h) for namespace cleanliness.

Library sources (including rwtest) #include the deprecated .h
headers to bring in POSIX and other non-C++ and non-C symbols.

Martin

Mime
View raw message