|
-
January 18th, 2013, 08:50 AM
#5
Re: warning C4715: 'CM::Instance' : not all control paths return a value
BTW, that code is illegal as you cannot return an lvalue reference to a temporary, so your code should not compile ( it does just because you're using a VC language extension ). Second, that warning seems wrong too as the switch should pass control to the last return statement when the wait result doesn't match ...
anyway, another possibility could be
4) to use a RAII syncronization object and throw an exception on failure
5) to return a pointer to CM ( being NULL in case of error ) or boost:: optional<CM&> if for some reason the Instance method is expected to not return a valid instance even under "normal" circumstances ...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|