Syllable Forum Index Syllable
Syllable Forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

0.6.6: MessageQueue::FindMessage() ambiguity

 
Post new topic   Reply to topic    Syllable Forum Index -> Bugs - Fixed
View previous topic :: View next topic  
Author Message
Morph
The Knights of Syllable


Joined: 18 Oct 2007
Posts: 316
Location: Australia

PostPosted: Tue Nov 04, 2008 4:56 pm    Post subject: 0.6.6: MessageQueue::FindMessage() ambiguity Reply with quote

[url=http://development.syllable.org/documentation/API/LibSyllable/classos_1_1MessageQueue.html]MessageQueue[/url] has two methods:
[code:1]Message * FindMessage (int nIndex) const
Message * FindMessage (int nCode, int nIndex=0) const[/code:1]
The default parameter in the second creates an ambiguity. Ie, if you try MessageQueue::FindMessage( 2 ), it is ambiguous whether it means FindMessage( 2 ) [the first method] or FindMessage( 2, 0 ) [the second with default nIndex], and the compiler fails with an error.
AFAIK, there is no way in C++ to specify which of the two you intend. Thus one must be renamed.

It seems MessageQueue::FindMessage() isn't used anywhere, so no-one has noticed this before.
Back to top
View user's profile Send private message Visit poster's website
Vanders
The Knights of Syllable


Joined: 14 Sep 2007
Posts: 849

PostPosted: Wed Nov 05, 2008 3:33 am    Post subject: Reply with quote

The obvious solution, to me, is to remove the first variant and add a special code that can be used to mean "Any".

This is one of those situations where vstubs.s is useful as we can remove the method without breaking the ABI by adding it's signature to vstubs
Back to top
View user's profile Send private message Send e-mail
Morph
The Knights of Syllable


Joined: 18 Oct 2007
Posts: 316
Location: Australia

PostPosted: Wed Nov 05, 2008 3:02 pm    Post subject: Reply with quote

Another solution would be to simply remove the default value from nIndex in the second one. That won't break anything because it doesn't change the signature.
Back to top
View user's profile Send private message Visit poster's website
Vanders
The Knights of Syllable


Joined: 14 Sep 2007
Posts: 849

PostPosted: Wed Nov 05, 2008 4:14 pm    Post subject: Reply with quote

[quote="Morph"]Another solution would be to simply remove the default value from nIndex in the second one. That won't break anything because it doesn't change the signature.[/quote]

That's true. If nothing is using those calls currently it wont break anything either. Go for it.
Back to top
View user's profile Send private message Send e-mail
Morph
The Knights of Syllable


Joined: 18 Oct 2007
Posts: 316
Location: Australia

PostPosted: Sun Nov 30, 2008 5:28 am    Post subject: Reply with quote

Fixed in cvs.
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Syllable Forum Index -> Bugs - Fixed All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group