The <string.h> and <cstring> includes are really the old C library "char *" 
manipulation functions.  <cstring> is equivalent to <string.h> but wrapped 
inside of the std namespace.  <string> on the other hand is purely for the C++ 
string class.  Depending on your compiler or other includes you might get the 
right behavior without these libraries explicitly included but it won't be 
portable and your mileage may vary.

On Dec 17, 2009, at 11:13 AM, David Knezevic wrote:

> Roy Stogner wrote:
>> 
>> Can you get the same behavior from a simple test case?
>> 
>> #include <cstring>
>> int main(void)
>> {
>>  strncpy(NULL, NULL, 0);
>> }
>> 
>> That ought to compile, at least.
> 
> This compiles for me, but it doesn't compile when I change <cstring> to 
> <string>, which seems consistent with the error I reported before.
> 
>> What compiler version are you using?
> 
> I'm using Ubuntu 9.10, gcc --version gives
> 
> gcc (Ubuntu 4.4.1-4ubuntu8) 4.4.1
> 
> 
> 
> Derek Gaston wrote:
>> Ok - the right thing (according to my compiler guru) is to include _both_ 
>> <string> and <cstring>.
>> 
>> Changing <string> to <string.h> you won't pick up std::string (although you 
>> probably got lucky and picked it up through another #include somewhere else).
>> 
> 
> This works for me...
> 
> - Dave
> 
> ------------------------------------------------------------------------------
> This SF.Net email is sponsored by the Verizon Developer Community
> Take advantage of Verizon's best-in-class app development support
> A streamlined, 14 day to market process makes app distribution fast and easy
> Join now and get one step closer to millions of Verizon customers
> http://p.sf.net/sfu/verizon-dev2dev 
> _______________________________________________
> Libmesh-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/libmesh-devel


------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
Libmesh-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-devel

Reply via email to