You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Anton Pevtsov <an...@moscow.vdiweb.com> on 2006/03/24 17:12:03 UTC

Re: svn commit: r387631 - /incubator/stdcxx/trunk/tests/strings/21.string.capacity.cpp

I added UserChars to this test. The updated version is attached

Here is the change log:

2006-03-24  Anton Pevtsov  <an...@moscow.vdiweb.com>

	* 21.string.capacity.cpp (MemFun): Add UChar member to charT
	enum.
	(test_resize): Updated to be able operate with UserChar's,
	strings output format in rw_assert calls changed to generic 
	strings.
	(test_capacity): The same.
	(rw_opt_no_user_chars): New cmd line option --no-user_chars.
	(run_test): UserChar's tests added.
	(main): New command line option added.

With best wishes,
Anton Pevtsov

-----Original Message-----
From: sebor@apache.org [mailto:sebor@apache.org] 
Sent: Wednesday, March 22, 2006 00:43
To: stdcxx-commits@incubator.apache.org
Subject: svn commit: r387631 -
/incubator/stdcxx/trunk/tests/strings/21.string.capacity.cpp


Author: sebor
Date: Tue Mar 21 13:42:52 2006
New Revision: 387631

URL: http://svn.apache.org/viewcvs?rev=387631&view=rev
Log:
2006-03-21  Martin Sebor  <se...@roguewave.com>

	* 21.string.capacity.cpp (LSTR, LLEN): New macros for
	convenience.
	(test_resize): Changed type of cparam argument to int and
	simplified.
	(test_capacity): Avoided returning the result of a call to a
	fuction
	returning void to prevent an HP aCC 3.63 error. Eliminated pstr
	local variable and used the same string object instead.
	(test_resize): Added test cases.

Modified:
...
    incubator/stdcxx/trunk/tests/strings/21.string.capacity.cpp


Re: svn commit: r387631 - /incubator/stdcxx/trunk/tests/strings/21.string.capacity.cpp

Posted by Martin Sebor <se...@roguewave.com>.
Anton Pevtsov wrote:

> I added UserChars to this test. The updated version is attached
> 
> Here is the change log:

Looks good.

FYI: the difference between string::c_str() and string::data()
is that the former guarantees that returned value points to a NUL
terminated character string (i.e., the function may append it if
it's not there), while the latter isn't required to do that. For
this reason data() should be preferred when interacting with
traditional C functions that expect NUL-terminated strings, while
data() should be used in all other contexts, especially those where
no reallocation of the string should be done. In our implementation
(and all others I'm aware of), there is no difference between the
two functions.

Martin