Re: [sigc] Unwanted pass-by-value behavior with MSVC++ 7.1



Am 23.07.2004 15:25:05 schrieb(en) Martin Schulze:
Am 11.07.2004 22:27:49 schrieb(en) Martin Schulze:
Am 08.07.2004 00:00:03 schrieb(en) James Lin:
Murray Cumming wrote:
>
> > Basically sigc::bind somehow was causing arguments to be
> > passed by value even when explicitly told to pass by
> > reference. (I verified this by passing an object by
> > reference that had a private copy-constructor and
> > getting a compile-time error.  Also, test_lambda was
> > producing incorrect results [....]
>
> A test case for this would be really useful. We could add
> it to the tests directory. In bugzilla please.

Okay, will do sometime this week.

To elaborate on the test_lambda case, before I disabled the
sun_forte_workaround calls with MSVC++, lines 69-71 in test_lambda. cc
produced (with optimizations enabled):

  ((++_1)*2)(ref(a)): 4; a: 1
  ((++(*_1))*2)(&a):  4; a: 2
  ((--(*(&_1)))*2)(ref(a)): 2; a: 2

(AFAICT, the correct values should be (4, 2), (6, 3), and (4, 2)
respectively.)

> > and that SIGC_WORKAROUND_OPERATOR_PARENTHESES and
> > LIBSIGC_TEMPLATE_PREFIX really do need their own,
> > independent tests.
>
> Yes, and I guess you are the best person to implement them.
> It's really quite simple, because there is already an example.
> You need to
>
> 1. Add an .m4 macro in scripts/cxx.m4. Copy the existing one
> and change
> [...]

Okay, but I'm not sure how useful that would be to Windows MSVC++
users, the
people who'd encounter the problem. Are MSVC++ users expected to run
the
configure script?

> Please tell me if you have any problems. Unfortunately, I
> don't think a check for WIN32 will be good enough, because there
> are now several versions of the MSVC++ compiler in common use,
> each with different capabilities.

That's true.  On the plus side, Microsoft has made the
VC++7.1/VC++2003
compiler available for free, and it can be installed alongside an
existing
Visual Studio installation.  Plus, the Visual Studio project files
included
with libsigc++ 2.0.3 already require VS.net 2003 anyway.

I've added the additional configure check. However through the lines I can see that this doesn't help you because you don't execute the configure script with MSVC, do you? Can we define some macros in the project file instead? We need to #define SIGC_CXX_MSVC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD. Could you please modify the project file accordingly and attach a patch against cvs to http://bugzilla.gnome.org/show_bug.cgi?id=147311 ?

James, could you please comment on this? I'd like to make that bugfix release by Friday next week at the latest.

Whoops, my mistake - I was barking nonsense. In fact, sigc++config.h needs to be configured according to the platform (-> for the MSVC, only 'SIGC_MSVC_TEMPLATE_SPECIALIZATION_OPERATOR_OVERLOAD' should be '#define'd there). Normally, this is done by the configure script. What options do we have with MSVC?

Regards,

 Martin



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