Pretty sure that is only guaranteed to work if you use std::strncpy - cstring should include strncpy inside the std:: namespace.
Perhaps the implementation for your compiler does not strictly enforce that which is why the code sniipet works? And of course, to get std::string you need <string> ----- Original Message ----- From: David Knezevic <[email protected]> To: libmesh-devel <[email protected]> Sent: Thu Dec 17 12:13:29 2009 Subject: Re: [Libmesh-devel] New getpot.h 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
