Re: [sigc] ANNOUNCE: libsigc++ 1.9.11



Martin Schulze wrote:
What is your opinion: would it be a problem to keep the MSVC compiler
generating these warning for the tests:
- warning C4267: 'argument' : conversion from 'size_t' to 'unsigned int', possible loss of data - warning C4244: 'argument' : conversion from 'const int' to 'const float', possible loss of data

I think it would not be a problem. An option would be to turn the warnings off using #pragma directives. I haven't checked if there is a preprocessor directive somewhere to detect the compiler? If there is, something like this could be done:

#ifdef _MSVC_NET_2003
#pragma warning(disable:4267)
#pragma warning(disable:4244)
#endif

<libsigc code here>

#ifdef _MSVC_NET_2003
#pragma warning(enable:4267)
#pragma warning(enable:4244)
#endif

  (Can there really be a data loss in a conversion from int to float?

I don't know, not for all I know, though I'd be interested if someone could explain to me why there could be.

   Do you know whether a conversion from int to double also triggers
   a warning?)

I just checked, it doesn't.

Could you try to compile something like:

  #include <iostream>

  struct foo {
    template <class T1>
    void test(T1 p) { std::cout << p << std::endl; }
  };

  int main() {
    foo f;
    f.test<unsigned int>(3);  // variant 1
    // f.template test<unsigned int>(3);  // variant 2
    // f.template void test<unsigned int>(3);  // variant 3
    // f.void test<unsigned int>(3);  // variant 4
    return 0;
  }

and pass me the result?

Variant 1: compiles ok, without a warning.
Variant 2: compiles ok, without a warning.
Variant 3: doesn't compile, error:

c:\test\test\test\test.cpp(12) : error C2059: syntax error : 'template'
c:\test\test\test\test.cpp(12) : error C2951: template declarations are only permitted at global or namespace scope

Variant 4: doesn't compile, error:
c:\test\test\test\test.cpp(13) : error C2061: syntax error : identifier 'test'

Also of interest would be if MSVC can handle arithmetic in the
template argument list like we use for the bind adaptor:

  #include <iostream>

  template <int i>
  struct foo {
    void test() { std::cout << i << std::endl; }
  };

  template <int j>
  void bar() {
    foo<j+1> f; // variant 1
    // foo<j?0:1> f; // variant 2
    // foo<j?0:j+1> f; // variant 3
    // foo<(j?0:j+1)> f; // variant 4
    f.test();
  }

  int main() {
    bar<0>();
    bar<1>();
    return 0;
  }

Variant 1: compiles ok, no warnings.
Variant 2: compiles ok, no warnings.
Variant 3: compiles ok, no warnings.
Variant 4: compiles ok, no warnings.

Thanks!

You're welcome. I think it would be really cool if the final release of libsigc2 would work with the visual studio compiler, I still use 1.2 for now but I can imagine I would want to upgrade in the future.

I've tracked down a few other errors. In some places (like in test_bind_return.cc) there is an error in a construct like
  std::cout << str << std::endl;
The error is about no operator being available which takes a right-hand argument 'std::string'. The solution is to add
#include <string>
to test_bind_return.cc.

Another problem was in bind_return.h on line 21. It reads

    { functor_.template operator()<typename type_trait<T_arg1>::pass>

Changing that to

    { functor_. operator()<typename type_trait<T_arg1>::pass>

makes it work.

test_bind_return.cc compiles after those two changes.

Another thing I found is on line 516 of slot.h There is a workaround for gcc there (at least that's what the comments say) and the msvc compiles chokes on that line. Maybe that part should be surrounded with compiler-ifdef's.

That's all for now, I don't have time to go any further. Please let me know if you want me to do more tests.

cheers,

roel


  Martin


Am 2003.10.29 12:48 schrieb(en) Roel Vanhout:

Martin Schulze wrote:

Generally, people are wanted to test libsigc++-1.9.11 and
report their experiences on the list, especially those
working with compilers other than gcc-3.2.


I cannot help you with the Forte compiler, but I have made project files for Visual Studio .Net 2003 for libsigc+++-1.9.11 and the test files. I have made it so that a .lib file is generated and there is a project file for every test. The directory structure is as follows:

libsigc++ root
    |- docs
    |- examples
    |- etc...
    |- visualstudio
        |- sigc
        |    |- sigc.vcproj
        |- tests
        |    |- test_accumulated
        |    |    |- test_accumulated.vcproj
        |    |- etc...
        |- libsigc.sln

This is how I would do it; if someone wants it in a different way, I can change it.

Furthermore, I've tried to build it ofcourse. Most of the tests failed. You can find a buildlog on http://www.stack.be/~roel/sigc2-vs2003-buildlog.txt. Basically, the library went ok, and 5 of the tests (test_accumulated, test_deduce_result_type, test_disconnect, test_mem_fun and test_ptr_fun) were ok too. You can have a look at the buildlog and maybe someone can deduce what the problem is with the rest; I have not enough knowledge of libsigc to do myself, unfortunately. For the brave soul who wants to try it, I've put a zip file with the project files on http://www.stack.be/~roel/visualstudio.zip. Copy it to your libsigc++ root dir, and unzip there - that will create the directory structure as described above.
Hope this helps.


cheers,

roel




--
Roel Vanhout - Programmer/Systems Administrator
RIKS BV
Papenstraat 8 - 6211 LG Maastricht, The Netherlands
Tel +31 (0)43 388 3708 - Fax +31 (0)43 325 3155




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]