You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by Fred Preston <PR...@uk.ibm.com> on 2005/07/22 11:00:28 UTC

Using consistent libraries... changing from to

Hi All, 
        We are using a combination of <string.h> and <string> in our code 
and this is now leading to problems in testing as the two libraries (at 
least the Microsoft C++ run-time libraries) are incompatible (check out 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_crt_c_run.2d.time_libraries.asp
).

To avoid future problems, I vote that we move to the newer incantation of 
the libraries i.e. we move from <string.h> to <string>.  If anyone thinks 
that this may cause problems please let me know, but from the web page, it 
seems that we have little choice...

P.S.
        I guess this also means changing <algorithm.h> to <algorithm>, 
<bitset.h> to <bitset>, <cassert.h> to <cassert>, <cctype.h> to <cctype>, 
<cerrno.h> to <cerrno>, <cfloat.h> to <cfloat>, <ciso646.h> to <ciso646>, 
<climits.h> to <climits>, <clocale.h> to <clocale>, <cmath.h> to <cmath>, 
<complex.h> to <complex>, <csetjmp.h> to <csetjmp>, <csignal.h> to 
<csignal>, <cstdarg.h> to <cstdarg>, <cstddef.h> to <cstddef>, <cstdio.h> 
to <cstdio>, <cstdlib.h> to <cstdlib>, <cstring.h> to <cstring>, <ctime.h> 
to <ctime>, <cwchar.h> to <cwchar>, <cwctype.h> to <cwctype>, <deque.h> to 
<deque>, <exception.h> to <exception>, <fstream.h> to <fstream>, 
<functional.h> to <functional>, <iomanip.h> to <iomanip>, <ios.h> to 
<ios>, <iosfwd.h> to <iosfwd>, <iostream.h> to <iostream>, <istream.h> to 
<istream>, <iterator.h> to <iterator>, <limits.h> to <limits>, <list.h> to 
<list>, <locale.h> to <locale>, <map.h> to <map>, <memory.h> to <memory>, 
<numeric.h> to <numeric>, <ostream.h> to <ostream>, <queue.h> to <queue>, 
<set.h> to <set>, <sstream.h> to <sstream>, <stack.h> to <stack>, 
<stdexcept.h> to <stdexcept>, <streambuf.h> to <streambuf>, <string.h> to 
<string>, <strstream.h> to <strstream>, <utility.h> to <utility>, 
<valarray.h> to <valarray> and <vector.h> to <vector>.

Regards,

Fred Preston.

Re: Using consistent libraries... changing from to

Posted by Samisa Abeysinghe <sa...@gmail.com>.
We have run into a problem using <string> in place of <string.h>
Hence we need to be careful replacing that.

As a correct fix, we should be replacinf <string.h> with  <cstring>
and not <string>

Thanks,
Samisa...

On 7/22/05, Henrik Nordberg <he...@edgewaystech.com> wrote:
>  
> The two libraries that are incompatible are the old and the new io stream
> libraries. 
> <string.h> and <string> can be used together because they don't do the same
> thing. <string.h> contains the old C string functions (strcpy(), et al.) and
> <string> contains std::string (C++), and again, you can mix these freely
> (though we are now supposed to include <cstring> instead of <string.h>). 
>   
> So, where you really have to watch out is if you use the old stream headers:
> <iostream.h> should be replaced by <iostream> etc. But I did a quick search
> for iostream.h and it doesn't seem to be used in axis. 
>   
>  - Henrik
>  
>  
> ----- Original Message ----- 
> From: Fred Preston 
> To: axis-c-dev@ws.apache.org 
> Sent: Friday, July 22, 2005 2:00 AM 
> Subject: Using consistent libraries... changing from <???.h> to <???> 
> 
> 
> Hi All, 
>         We are using a combination of <string.h> and <string> in our code
> and this is now leading to problems in testing as the two libraries (at
> least the Microsoft C++ run-time libraries) are incompatible (check out
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_crt_c_run.2d.time_libraries.asp).
> 
> To avoid future problems, I vote that we move to the newer incantation of
> the libraries i.e. we move from <string.h> to <string>.  If anyone thinks
> that this may cause problems please let me know, but from the web page, it
> seems that we have little choice... 
> 
> P.S. 
>         I guess this also means changing <algorithm.h> to <algorithm>,
> <bitset.h> to <bitset>, <cassert.h> to <cassert>, <cctype.h> to <cctype>,
> <cerrno.h> to <cerrno>, <cfloat.h> to <cfloat>, <ciso646.h> to <ciso646>,
> <climits.h> to <climits>, <clocale.h> to <clocale>, <cmath.h> to <cmath>,
> <complex.h> to <complex>, <csetjmp.h> to <csetjmp>, <csignal.h> to
> <csignal>, <cstdarg.h> to <cstdarg>, <cstddef.h> to <cstddef>, <cstdio.h> to
> <cstdio>, <cstdlib.h> to <cstdlib>, <cstring.h> to <cstring>, <ctime.h> to
> <ctime>, <cwchar.h> to <cwchar>, <cwctype.h> to <cwctype>, <deque.h> to
> <deque>, <exception.h> to <exception>, <fstream.h> to <fstream>,
> <functional.h> to <functional>, <iomanip.h> to <iomanip>, <ios.h> to <ios>,
> <iosfwd.h> to <iosfwd>, <iostream.h> to <iostream>, <istream.h> to
> <istream>, <iterator.h> to <iterator>, <limits.h> to <limits>, <list.h> to
> <list>, <locale.h> to <locale>, <map.h> to <map>, <memory.h> to <memory>,
> <numeric.h> to <numeric>, <ostream.h> to <ostream>, <queue.h> to <queue>,
> <set.h> to <set>, <sstream.h> to <sstream>, <stack.h> to <stack>,
> <stdexcept.h> to <stdexcept>, <streambuf.h> to <streambuf>, <string.h> to
> <string>, <strstream.h> to <strstream>, <utility.h> to <utility>,
> <valarray.h> to <valarray> and <vector.h> to <vector>. 
> 
> Regards, 
> 
> Fred Preston.
>

Re: Using consistent libraries... changing from to

Posted by Henrik Nordberg <he...@edgewaystech.com>.
The two libraries that are incompatible are the old and the new io stream libraries.
<string.h> and <string> can be used together because they don't do the same thing. <string.h> contains the old C string functions (strcpy(), et al.) and <string> contains std::string (C++), and again, you can mix these freely (though we are now supposed to include <cstring> instead of <string.h>).

So, where you really have to watch out is if you use the old stream headers: <iostream.h> should be replaced by <iostream> etc. But I did a quick search for iostream.h and it doesn't seem to be used in axis.

 - Henrik
  ----- Original Message ----- 
  From: Fred Preston 
  To: axis-c-dev@ws.apache.org 
  Sent: Friday, July 22, 2005 2:00 AM
  Subject: Using consistent libraries... changing from <???.h> to <???>



  Hi All, 
          We are using a combination of <string.h> and <string> in our code and this is now leading to problems in testing as the two libraries (at least the Microsoft C++ run-time libraries) are incompatible (check out http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_crt_c_run.2d.time_libraries.asp). 

  To avoid future problems, I vote that we move to the newer incantation of the libraries i.e. we move from <string.h> to <string>.  If anyone thinks that this may cause problems please let me know, but from the web page, it seems that we have little choice... 

  P.S. 
          I guess this also means changing <algorithm.h> to <algorithm>, <bitset.h> to <bitset>, <cassert.h> to <cassert>, <cctype.h> to <cctype>, <cerrno.h> to <cerrno>, <cfloat.h> to <cfloat>, <ciso646.h> to <ciso646>, <climits.h> to <climits>, <clocale.h> to <clocale>, <cmath.h> to <cmath>, <complex.h> to <complex>, <csetjmp.h> to <csetjmp>, <csignal.h> to <csignal>, <cstdarg.h> to <cstdarg>, <cstddef.h> to <cstddef>, <cstdio.h> to <cstdio>, <cstdlib.h> to <cstdlib>, <cstring.h> to <cstring>, <ctime.h> to <ctime>, <cwchar.h> to <cwchar>, <cwctype.h> to <cwctype>, <deque.h> to <deque>, <exception.h> to <exception>, <fstream.h> to <fstream>, <functional.h> to <functional>, <iomanip.h> to <iomanip>, <ios.h> to <ios>, <iosfwd.h> to <iosfwd>, <iostream.h> to <iostream>, <istream.h> to <istream>, <iterator.h> to <iterator>, <limits.h> to <limits>, <list.h> to <list>, <locale.h> to <locale>, <map.h> to <map>, <memory.h> to <memory>, <numeric.h> to <numeric>, <ostream.h> to <ostream>, <queue.h> to <queue>, <set.h> to <set>, <sstream.h> to <sstream>, <stack.h> to <stack>, <stdexcept.h> to <stdexcept>, <streambuf.h> to <streambuf>, <string.h> to <string>, <strstream.h> to <strstream>, <utility.h> to <utility>, <valarray.h> to <valarray> and <vector.h> to <vector>. 

  Regards, 

  Fred Preston.