You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Martin Sebor <se...@roguewave.com> on 2008/06/03 01:37:30 UTC

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 <er...@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/containers/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))

>  
>              // verify ctor with a strict InputIterator
>              InputIter<T> first (vals,     vals,     vals + i);
> 
[...]
> Modified: stdcxx/branches/4.2.x/tests/support/18.exception.cpp
> URL: http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/support/18.exception.cpp?rev=662518&r1=662517&r2=662518&view=diff
> ==============================================================================
> --- stdcxx/branches/4.2.x/tests/support/18.exception.cpp (original)
> +++ stdcxx/branches/4.2.x/tests/support/18.exception.cpp Mon Jun  2 11:59:24 2008
> @@ -668,7 +668,7 @@
>          // exclude exception, bad_alloc, bad_cast, and bad_exception
>          // they are typically generated by the compiler and their
>          // what() strings are implementation-specific
> -        unsigned en = j % ((sizeof expect / sizeof *expect) - 5);
> +        size_t en = j % ((sizeof expect / sizeof *expect) - 5);


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.

Martin

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

Posted by Martin Sebor <se...@roguewave.com>.
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 <er...@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

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

Posted by Eric Lemings <Er...@roguewave.com>.
 

> -----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 <er...@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?

> >  
> >              // verify ctor with a strict InputIterator
> >              InputIter<T> first (vals,     vals,     vals + i);
> > 
> [...]
> > Modified: stdcxx/branches/4.2.x/tests/support/18.exception.cpp
> > URL: 
> http://svn.apache.org/viewvc/stdcxx/branches/4.2.x/tests/suppo
> rt/18.exception.cpp?rev=662518&r1=662517&r2=662518&view=diff
> > 
> ==============================================================
> ================
> > --- stdcxx/branches/4.2.x/tests/support/18.exception.cpp (original)
> > +++ stdcxx/branches/4.2.x/tests/support/18.exception.cpp 
> Mon Jun  2 11:59:24 2008
> > @@ -668,7 +668,7 @@
> >          // exclude exception, bad_alloc, bad_cast, and 
> bad_exception
> >          // they are typically generated by the compiler and their
> >          // what() strings are implementation-specific
> > -        unsigned en = j % ((sizeof expect / sizeof *expect) - 5);
> > +        size_t en = j % ((sizeof expect / sizeof *expect) - 5);
> 
> 
> 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.

Brad.