Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Fiquet

Pages: [1]
1
General discussions / Re: Some last remarks
« on: April 04, 2012, 12:58:31 am »
Hi everybody,

Quote
Thread::Thread((void(C::*function)(), C *object)
The object parameter may not be NULL, thus it should be a reference, conforming to the general SFML style.
I want it to be clear enough that the pointer will be used later; with a reference I expect people to pass local instances and get undefined behaviours. Moreover, this overload will often be used inside classes, with "this".

Just to mention that once I had a "problem" with this design within a project using SFML. VC++ 2010 gave me a warning:

Code: [Select]
warning C4355: 'this' : used in base member initializer list
Because the only way to construct a sf::Thread with the current object is indeed to call its constructor with this in the initiazer list. However the code worked properly.

Perhaps would it be worth to add the possibility of setting this parameter after the object construction itself?

Pages: [1]