gamedevlists-windows Mailing List for gamedev (Page 6)
Brought to you by:
vexxed72
You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(48) |
Oct
(58) |
Nov
(49) |
Dec
(38) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(124) |
Feb
(83) |
Mar
(17) |
Apr
(37) |
May
(12) |
Jun
(20) |
Jul
(47) |
Aug
(74) |
Sep
(62) |
Oct
(72) |
Nov
(54) |
Dec
(13) |
2003 |
Jan
(36) |
Feb
(8) |
Mar
(38) |
Apr
(3) |
May
(6) |
Jun
(133) |
Jul
(20) |
Aug
(18) |
Sep
(12) |
Oct
(4) |
Nov
(28) |
Dec
(36) |
2004 |
Jan
(22) |
Feb
(51) |
Mar
(28) |
Apr
(9) |
May
(20) |
Jun
(9) |
Jul
(37) |
Aug
(20) |
Sep
(23) |
Oct
(15) |
Nov
(23) |
Dec
(27) |
2005 |
Jan
(22) |
Feb
(20) |
Mar
(5) |
Apr
(14) |
May
(10) |
Jun
|
Jul
(6) |
Aug
(6) |
Sep
|
Oct
(12) |
Nov
(1) |
Dec
|
2006 |
Jan
(18) |
Feb
(4) |
Mar
(3) |
Apr
(6) |
May
(4) |
Jun
(3) |
Jul
(16) |
Aug
(40) |
Sep
(6) |
Oct
(1) |
Nov
|
Dec
(2) |
2007 |
Jan
(5) |
Feb
(2) |
Mar
(4) |
Apr
(1) |
May
(13) |
Jun
|
Jul
(26) |
Aug
(3) |
Sep
(10) |
Oct
|
Nov
(4) |
Dec
(5) |
2008 |
Jan
(1) |
Feb
|
Mar
(4) |
Apr
|
May
|
Jun
(5) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
(3) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Jon W. <hp...@mi...> - 2006-08-14 01:09:29
|
What's confusing is that your code uses the name DynamicArray (which I suppose is close to ArrayList in .NET), and your C++ test sample probably used std::vector, but you keep referring to the container as a "list". They are very different kinds of containers. You will note that C++ allows you to insert and delete objects in a std::list, but not in a std::vector. The reason is that vectors are guaranteed to be contiguous, and thus iterators (which may be simple pointers) would get invalidated when resizing the underlying storage. Meanwhile, when deleting from a list, the only iterator that gets invalidated is an iterator pointing to the element being deleted. Cheers, / h+ Carsten Orthbandt wrote: > The obvious question is how should an active iterator react if the traversed list > changes? To answer this, I simply tried it out in two languages I know that do > provide both dynamic arrays and foreach: STL, Tcl and C#. > |
From: Richard F. <ra...@de...> - 2006-08-13 20:39:43
|
On 8/13/06, Carsten Orthbandt <car...@se...> wrote: > > I'm afraid I wasn't clear. The actual data structure of the list > or array may be anything. In the case at hand, it is not a linked > list. for the sake of one word difference ;) "but you could always attach the iterators to the linked list on iterator construction." "but you could always attach the iterators to a linked list on iterator construction." hehe The linked list I was referring to would be a linked list > of all iterators attached to a specific array instance specifically > for adjusting the iterators on list changes. So yes, that's what > I was about to do. yes, this is what we do. Modifying arrays poses some serious challenges for multi-threaded > operation anyway, I don't think it's getting much harder with this > iterator scheme in place. I was planning to do heavy multi-threading > through thread pools and task lists that operate in higher level > chunks as to not spend to much time on the threading itself. My impression of working multi-threaded has been that we have to stop hoping, and start proactivley ensuring. I agree with Mat Noguchi, we should really dissallow the modification of any containers contents while we are iterating them. We used to do it this way in our scheduler, and may return to it once we start fulltime development on the next gen platforms. -- fabs(); |
From: Mat N. \(BUNGIE\) <Mat...@mi...> - 2006-08-13 19:00:29
|
If it's a scripting language, don't allow direct manipulation of a = container while iterating through it. =20 If you want the side effects of such an operation, defer them until all = iterators have been destroyed. =20 MSN ________________________________ From: gam...@li... on behalf of = Carsten Orthbandt Sent: Sun 8/13/2006 4:21 AM To: Game Development for MS Windows Subject: Re: [GD-Windows] Array foreach in scripting languages I'm afraid I wasn't clear. The actual data structure of the list or array may be anything. In the case at hand, it is not a linked list. The linked list I was referring to would be a linked list of all iterators attached to a specific array instance specifically for adjusting the iterators on list changes. So yes, that's what I was about to do. Modifying arrays poses some serious challenges for multi-threaded operation anyway, I don't think it's getting much harder with this iterator scheme in place. I was planning to do heavy multi-threading through thread pools and task lists that operate in higher level chunks as to not spend to much time on the threading itself. Best regards, Carsten Orthbandt Founder + Development Director SEK SpieleEntwicklungsKombinat GmbH http://www.sek-ost.de <http://www.sek-ost.de/>=20 Wenn ich Visionen habe, gehe ich zum Arzt. - Helmut Schmidt =20 ________________________________ Von: gam...@li... im Auftrag von = Richard Fabian Gesendet: So 13.08.2006 12:13 An: Game Development for MS Windows Betreff: Re: [GD-Windows] Array foreach in scripting languages Dunno if it suits how you work, but you could always attach the = iterators to the linked list on iterator construction. this way you can tell all the currently attached iterators that element = X is gone, handle it. with thiis in place, we've never had any problems with our iterators, = but i suspect that we may have problems in the future with PS3 and such = because this technique doesn't lend itself to threaded access. On 8/13/06, Carsten Orthbandt <car...@se...> wrote: The reason I'd like to have this work is that it is a recurring pattern in lots of code I see (iterating a list and deleting/inserting entries). =20 If I go the route with tracked iterators, any insert or delete operation will work as expected since then I'm dealing with these cases per iterator: =20 - delete item before or at current position -> decrement position and size - delete item after current position -> decrement size - insert item before or at current position -> increment position and size - insert item after current position -> increment size =20 The case "delete item at current position" potentially has to deal with the actual element being deleted. In C++ this would be a problem but in my scripting language the list entry would go away but the actual value referenced will stay around due the iterator still holding onto it. =20 I'm quite surprised that the C# docs don't even mention this situation. I'm even more surprised to find that MS added a "for each" to C++. It's supposed to be only for managed code but it worked fine in my standard STL unmanaged test. =20 Simply banning this scenario would mean that users have to write such code: =20 int i,iC=3DList.GetSize(); for(i=3D0;i<iC;i++) { if(Condition(List[i])) { List.Delete(i); i--;iC--; } }; =20 manually. Which is goes against the whole idea of pro- viding a foreach and IMHO even more error-prone. I'm not sure if I more dislike the C#/STL behaviour of throwing an exception or the Python behaviour of simply ignoring the problem. =20 <rant> In my case, an exception is not an option since I'm not going to clutter my cute little scripting language with a concept (exceptions) that I consider totally broken in the first place. There's no place in a game for such stuff. It has to run, period. So you have to handle all error conditions anyway. </rant> =20 Best regards, =20 Carsten Orthbandt Founder + Development Director SEK SpieleEntwicklungsKombinat GmbH http://www.sek-ost.de <http://www.sek-ost.de/>=20 =20 Wenn ich Visionen habe, gehe ich zum Arzt. - Helmut Schmidt =20 =20 =20 ________________________________ =20 Von: gam...@li... im = Auftrag von Kent Quirk Gesendet: So 13.08.2006 04:39 An: Game Development for MS Windows Betreff: Re: [GD-Windows] Array foreach in scripting languages =20 =20 =20 In Python, I was shocked to find that this succeeds: =20 L =3D range(20) for i in L: print i if i=3D=3D4: del L[6] =20 Result: ------- 0 1 2 3 4 5 7 8 9 =20 I fully expected it to fail. I consider messing with the list = you're traversing with an iterator to be on a par with sawing off the = branch you're standing on, unless, as you imply, the list is known to = be implemented as a linked list. In python, you can surprise = yourself. Consider this: =20 for i in L: print i if i=3D=3D4: del L[3] # delete one of the items BEFORE the one = you're on =20 =20 0 1 2 3 4 6 7 8 9 =20 So what happened is that we ended up skipping element #5, even = though we deleted element 3. =20 This is really dependent on the implementation details of the = particular interpreter, and probably isn't guaranteed by the average = language spec. =20 If you feel strongly about being able to do this, you have to = deal with the case of deleting the item you're on right now, and also = about deleting the last element while you're at the last element. = Check this out: =20 >>> L ['h', 'e', 'l', 'l', 'o'] >>> for c in L: if c=3D=3D'l': L.remove(c) =20 >>> L ['h', 'e', 'l', 'o'] =20 In other words, even though I intended to remove BOTH 'l' = characters, only one of them was removed because deleting one caused me to = skip the next element. =20 I think this stuff is so fraught with potential errors by the = user, even if YOU get it right, that I'd prefer to just ban the practice = and make people use a "filter" concept like in python, or a remove_if as = in STL. =20 Kent =20 =20 Carsten Orthbandt wrote: > I'm currently building a small scripting language for = interactive stuff. Now I > know there's plenty out there, I'm just doing this for fun. > > A tricky question came up and I'd like to collect opinions and = experiences on > this. It's about foreach for dynamic arrays. Consider this = C++-like pseudo code: > > DynamicArray<int> list; > int i; > for(i=3D0;i<20;i++){list.Add(i);}; > foreach(i in list){ > print(i); > if(i=3D=3D8){list.Delete(12);}; > }; > > The obvious question is how should an active iterator react if = the traversed list > changes? To answer this, I simply tried it out in two = languages I know that do > provide both dynamic arrays and foreach: STL, Tcl and C#. > > In STL C++ code, I get an exception because of iterator = incompatibility. > In Tcl this problem isn't one because the iterator takes a = snapshot of the list > object on start and there's no language construct to actually = change this instance. > In C# with the List<int> generic, I get an exception because = the iterated object > changes (interestingly, this happens on ANY change to the = list, even appending). > > Now what I'd like to know: > - how do other languages cope with this? (Tcl doesn't need to, = C++/C# simply fails) > - what do YOU think would be sensible behaviour? > > Currently I'm considering having all iterators be elements of = a double-linked list > and let the array object be the dl-list head. So if the number = of array elements > changes, it can run through all attached iterators and fix = their indices or stop them. > > =20 =20 = -------------------------------------------------------------------------= Using Tomcat but need to do more? Need to support web services, = security? Get stuff done quickly with pre-integrated technology to make = your job easier Download IBM WebSphere Application Server v.1.0.1 based on = Apache Geronimo = http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D= 121642 _______________________________________________ Gamedevlists-windows mailing list Gam...@li... = https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 =20 =20 =20 = -------------------------------------------------------------------------= Using Tomcat but need to do more? Need to support web services, = security? Get stuff done quickly with pre-integrated technology to make = your job easier Download IBM WebSphere Application Server v.1.0.1 based on = Apache Geronimo = http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D= 121642 _______________________________________________ Gamedevlists-windows mailing list Gam...@li... = https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 =20 -- fabs(); -------------------------------------------------------------------------= Using Tomcat but need to do more? Need to support web services, = security? Get stuff done quickly with pre-integrated technology to make your job = easier Download IBM WebSphere Application Server v.1.0.1 based on Apache = Geronimo http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D= 121642 _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 |
From: Carsten O. <car...@se...> - 2006-08-13 11:25:24
|
I'm afraid I wasn't clear. The actual data structure of the list or array may be anything. In the case at hand, it is not a linked list. The linked list I was referring to would be a linked list of all iterators attached to a specific array instance specifically for adjusting the iterators on list changes. So yes, that's what I was about to do. Modifying arrays poses some serious challenges for multi-threaded operation anyway, I don't think it's getting much harder with this iterator scheme in place. I was planning to do heavy multi-threading through thread pools and task lists that operate in higher level chunks as to not spend to much time on the threading itself. =20 Best regards, =20 Carsten Orthbandt Founder + Development Director SEK SpieleEntwicklungsKombinat GmbH http://www.sek-ost.de Wenn ich Visionen habe, gehe ich zum Arzt. - Helmut Schmidt =20 =20 ________________________________ Von: gam...@li... im Auftrag von = Richard Fabian Gesendet: So 13.08.2006 12:13 An: Game Development for MS Windows Betreff: Re: [GD-Windows] Array foreach in scripting languages Dunno if it suits how you work, but you could always attach the = iterators to the linked list on iterator construction. this way you can tell all the currently attached iterators that element = X is gone, handle it. with thiis in place, we've never had any problems with our iterators, = but i suspect that we may have problems in the future with PS3 and such = because this technique doesn't lend itself to threaded access. On 8/13/06, Carsten Orthbandt <car...@se...> wrote:=20 The reason I'd like to have this work is that it is a recurring pattern in lots of code I see (iterating a list and deleting/inserting entries). =09 If I go the route with tracked iterators, any insert or delete operation will work as expected since then=20 I'm dealing with these cases per iterator: =09 - delete item before or at current position -> decrement position and size - delete item after current position -> decrement size - insert item before or at current position=20 -> increment position and size - insert item after current position -> increment size =09 The case "delete item at current position" potentially has to deal with the actual element being deleted.=20 In C++ this would be a problem but in my scripting language the list entry would go away but the actual value referenced will stay around due the iterator still holding onto it. =09 I'm quite surprised that the C# docs don't even mention=20 this situation. I'm even more surprised to find that MS added a "for each" to C++. It's supposed to be only for managed code but it worked fine in my standard STL unmanaged test. =09 Simply banning this scenario would mean that users have=20 to write such code: =09 int i,iC=3DList.GetSize(); for(i=3D0;i<iC;i++) { if(Condition(List[i])) { List.Delete(i); i--;iC--; } }; =09 manually. Which is goes against the whole idea of pro-=20 viding a foreach and IMHO even more error-prone. I'm not sure if I more dislike the C#/STL behaviour of throwing an exception or the Python behaviour of simply ignoring the problem. =09 <rant> In my case, an exception is not an option since I'm not=20 going to clutter my cute little scripting language with a concept (exceptions) that I consider totally broken in the first place. There's no place in a game for such stuff. It has to run, period. So you have to handle all=20 error conditions anyway. </rant> =09 Best regards, =09 Carsten Orthbandt Founder + Development Director SEK SpieleEntwicklungsKombinat GmbH http://www.sek-ost.de=20 =09 Wenn ich Visionen habe, gehe ich zum Arzt. - Helmut Schmidt =09 =09 =09 ________________________________ =09 Von: gam...@li... im Auftrag von = Kent Quirk Gesendet: So 13.08.2006 04:39 An: Game Development for MS Windows Betreff: Re: [GD-Windows] Array foreach in scripting languages =09 =09 =09 In Python, I was shocked to find that this succeeds:=20 =09 L =3D range(20) for i in L: print i if i=3D=3D4: del L[6] =09 Result: ------- 0 1 2 3 4 5 7 8 9 =09 I fully expected it to fail. I consider messing with the list you're=20 traversing with an iterator to be on a par with sawing off the branch you're standing on, unless, as you imply, the list is known to be implemented as a linked list. In python, you can surprise yourself. Consider this:=20 =09 for i in L: print i if i=3D=3D4: del L[3] # delete one of the items BEFORE the one you're = on =09 =09 0 1 2 3 4 6 7 8 9 =09 So what happened is that we ended up skipping element #5, even though = we=20 deleted element 3. =09 This is really dependent on the implementation details of the = particular interpreter, and probably isn't guaranteed by the average language = spec. =09 If you feel strongly about being able to do this, you have to deal with = the case of deleting the item you're on right now, and also about deleting the last element while you're at the last element. Check this = out: =09 >>> L ['h', 'e', 'l', 'l', 'o'] >>> for c in L:=20 if c=3D=3D'l': L.remove(c) =09 >>> L ['h', 'e', 'l', 'o'] =09 In other words, even though I intended to remove BOTH 'l' characters, only one of them was removed because deleting one caused me to skip the = next element. =09 I think this stuff is so fraught with potential errors by the user, = even if YOU get it right, that I'd prefer to just ban the practice and make people use a "filter" concept like in python, or a remove_if as in STL. = =09 Kent =09 =09 Carsten Orthbandt wrote: > I'm currently building a small scripting language for interactive = stuff. Now I > know there's plenty out there, I'm just doing this for fun. > > A tricky question came up and I'd like to collect opinions and = experiences on=20 > this. It's about foreach for dynamic arrays. Consider this C++-like = pseudo code: > > DynamicArray<int> list; > int i; > for(i=3D0;i<20;i++){list.Add(i);}; > foreach(i in list){=20 > print(i); > if(i=3D=3D8){list.Delete(12);}; > }; > > The obvious question is how should an active iterator react if the = traversed list > changes? To answer this, I simply tried it out in two languages I = know that do=20 > provide both dynamic arrays and foreach: STL, Tcl and C#. > > In STL C++ code, I get an exception because of iterator = incompatibility. > In Tcl this problem isn't one because the iterator takes a snapshot = of the list=20 > object on start and there's no language construct to actually change = this instance. > In C# with the List<int> generic, I get an exception because the = iterated object > changes (interestingly, this happens on ANY change to the list, even = appending).=20 > > Now what I'd like to know: > - how do other languages cope with this? (Tcl doesn't need to, C++/C# = simply fails) > - what do YOU think would be sensible behaviour? > > Currently I'm considering having all iterators be elements of a = double-linked list=20 > and let the array object be the dl-list head. So if the number of = array elements > changes, it can run through all attached iterators and fix their = indices or stop them. > > =09 =09 = -------------------------------------------------------------------------= =20 Using Tomcat but need to do more? Need to support web services, = security? Get stuff done quickly with pre-integrated technology to make your job = easier Download IBM WebSphere Application Server v.1.0.1 based on Apache = Geronimo=20 = http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D= 121642 _______________________________________________=20 Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 =09 =09 =09 = -------------------------------------------------------------------------= Using Tomcat but need to do more? Need to support web services, = security? Get stuff done quickly with pre-integrated technology to make your job = easier=20 Download IBM WebSphere Application Server v.1.0.1 based on Apache = Geronimo = http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D= 121642=20 _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 =09 --=20 fabs();=20 |
From: Richard F. <ra...@de...> - 2006-08-13 10:13:49
|
Dunno if it suits how you work, but you could always attach the iterators to the linked list on iterator construction. this way you can tell all the currently attached iterators that element X is gone, handle it. with thiis in place, we've never had any problems with our iterators, but i suspect that we may have problems in the future with PS3 and such because this technique doesn't lend itself to threaded access. On 8/13/06, Carsten Orthbandt <car...@se...> wrote: > > The reason I'd like to have this work is that it is a > recurring pattern in lots of code I see (iterating a > list and deleting/inserting entries). > > If I go the route with tracked iterators, any insert > or delete operation will work as expected since then > I'm dealing with these cases per iterator: > > - delete item before or at current position > -> decrement position and size > - delete item after current position > -> decrement size > - insert item before or at current position > -> increment position and size > - insert item after current position > -> increment size > > The case "delete item at current position" potentially > has to deal with the actual element being deleted. > In C++ this would be a problem but in my scripting > language the list entry would go away but the actual > value referenced will stay around due the iterator > still holding onto it. > > I'm quite surprised that the C# docs don't even mention > this situation. I'm even more surprised to find that MS > added a "for each" to C++. It's supposed to be only for > managed code but it worked fine in my standard STL > unmanaged test. > > Simply banning this scenario would mean that users have > to write such code: > > int i,iC=List.GetSize(); > for(i=0;i<iC;i++) > { > if(Condition(List[i])) > { > List.Delete(i); > i--;iC--; > } > }; > > manually. Which is goes against the whole idea of pro- > viding a foreach and IMHO even more error-prone. > I'm not sure if I more dislike the C#/STL behaviour of > throwing an exception or the Python behaviour of simply > ignoring the problem. > > <rant> > In my case, an exception is not an option since I'm not > going to clutter my cute little scripting language with > a concept (exceptions) that I consider totally broken > in the first place. There's no place in a game for such > stuff. It has to run, period. So you have to handle all > error conditions anyway. > </rant> > > Best regards, > > Carsten Orthbandt > Founder + Development Director > SEK SpieleEntwicklungsKombinat GmbH > http://www.sek-ost.de > > Wenn ich Visionen habe, gehe ich zum Arzt. - Helmut Schmidt > > > > ________________________________ > > Von: gam...@li... im Auftrag von > Kent Quirk > Gesendet: So 13.08.2006 04:39 > An: Game Development for MS Windows > Betreff: Re: [GD-Windows] Array foreach in scripting languages > > > > In Python, I was shocked to find that this succeeds: > > L = range(20) > for i in L: > print i > if i==4: > del L[6] > > Result: > ------- > 0 > 1 > 2 > 3 > 4 > 5 > 7 > 8 > 9 > > I fully expected it to fail. I consider messing with the list you're > traversing with an iterator to be on a par with sawing off the branch > you're standing on, unless, as you imply, the list is known to be > implemented as a linked list. In python, you can surprise yourself. > Consider this: > > for i in L: > print i > if i==4: > del L[3] # delete one of the items BEFORE the one you're on > > > 0 > 1 > 2 > 3 > 4 > 6 > 7 > 8 > 9 > > So what happened is that we ended up skipping element #5, even though we > deleted element 3. > > This is really dependent on the implementation details of the particular > interpreter, and probably isn't guaranteed by the average language spec. > > If you feel strongly about being able to do this, you have to deal with > the case of deleting the item you're on right now, and also about > deleting the last element while you're at the last element. Check this > out: > > >>> L > ['h', 'e', 'l', 'l', 'o'] > >>> for c in L: > if c=='l': > L.remove(c) > > >>> L > ['h', 'e', 'l', 'o'] > > In other words, even though I intended to remove BOTH 'l' characters, > only one of them was removed because deleting one caused me to skip the > next element. > > I think this stuff is so fraught with potential errors by the user, even > if YOU get it right, that I'd prefer to just ban the practice and make > people use a "filter" concept like in python, or a remove_if as in STL. > > Kent > > > Carsten Orthbandt wrote: > > I'm currently building a small scripting language for interactive stuff. > Now I > > know there's plenty out there, I'm just doing this for fun. > > > > A tricky question came up and I'd like to collect opinions and > experiences on > > this. It's about foreach for dynamic arrays. Consider this C++-like > pseudo code: > > > > DynamicArray<int> list; > > int i; > > for(i=0;i<20;i++){list.Add(i);}; > > foreach(i in list){ > > print(i); > > if(i==8){list.Delete(12);}; > > }; > > > > The obvious question is how should an active iterator react if the > traversed list > > changes? To answer this, I simply tried it out in two languages I know > that do > > provide both dynamic arrays and foreach: STL, Tcl and C#. > > > > In STL C++ code, I get an exception because of iterator incompatibility. > > In Tcl this problem isn't one because the iterator takes a snapshot of > the list > > object on start and there's no language construct to actually change > this instance. > > In C# with the List<int> generic, I get an exception because the > iterated object > > changes (interestingly, this happens on ANY change to the list, even > appending). > > > > Now what I'd like to know: > > - how do other languages cope with this? (Tcl doesn't need to, C++/C# > simply fails) > > - what do YOU think would be sensible behaviour? > > > > Currently I'm considering having all iterators be elements of a > double-linked list > > and let the array object be the dl-list head. So if the number of array > elements > > changes, it can run through all attached iterators and fix their indices > or stop them. > > > > > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=555 > > > > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job > easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=555 > -- fabs(); |
From: Carsten O. <car...@se...> - 2006-08-13 06:08:39
|
The reason I'd like to have this work is that it is a recurring pattern in lots of code I see (iterating a list and deleting/inserting entries). =20 If I go the route with tracked iterators, any insert or delete operation will work as expected since then I'm dealing with these cases per iterator: =20 - delete item before or at current position -> decrement position and size - delete item after current position -> decrement size - insert item before or at current position -> increment position and size - insert item after current position -> increment size =20 The case "delete item at current position" potentially has to deal with the actual element being deleted. In C++ this would be a problem but in my scripting language the list entry would go away but the actual value referenced will stay around due the iterator still holding onto it. =20 I'm quite surprised that the C# docs don't even mention this situation. I'm even more surprised to find that MS added a "for each" to C++. It's supposed to be only for managed code but it worked fine in my standard STL unmanaged test. =20 Simply banning this scenario would mean that users have to write such code: =20 int i,iC=3DList.GetSize(); for(i=3D0;i<iC;i++) { if(Condition(List[i])) { List.Delete(i); i--;iC--; } }; =20 manually. Which is goes against the whole idea of pro- viding a foreach and IMHO even more error-prone. I'm not sure if I more dislike the C#/STL behaviour of throwing an exception or the Python behaviour of simply ignoring the problem. =20 <rant> In my case, an exception is not an option since I'm not going to clutter my cute little scripting language with a concept (exceptions) that I consider totally broken in the first place. There's no place in a game for such stuff. It has to run, period. So you have to handle all error conditions anyway. </rant> =20 Best regards, =20 Carsten Orthbandt Founder + Development Director SEK SpieleEntwicklungsKombinat GmbH http://www.sek-ost.de Wenn ich Visionen habe, gehe ich zum Arzt. - Helmut Schmidt =20 =20 ________________________________ Von: gam...@li... im Auftrag von = Kent Quirk Gesendet: So 13.08.2006 04:39 An: Game Development for MS Windows Betreff: Re: [GD-Windows] Array foreach in scripting languages In Python, I was shocked to find that this succeeds: L =3D range(20) for i in L: print i if i=3D=3D4: del L[6] Result: ------- 0 1 2 3 4 5 7 8 9 I fully expected it to fail. I consider messing with the list you're traversing with an iterator to be on a par with sawing off the branch you're standing on, unless, as you imply, the list is known to be implemented as a linked list. In python, you can surprise yourself. Consider this: for i in L: print i if i=3D=3D4: del L[3] # delete one of the items BEFORE the one you're = on =20 0 1 2 3 4 6 7 8 9 So what happened is that we ended up skipping element #5, even though we deleted element 3. This is really dependent on the implementation details of the particular interpreter, and probably isn't guaranteed by the average language spec. If you feel strongly about being able to do this, you have to deal with the case of deleting the item you're on right now, and also about deleting the last element while you're at the last element. Check this = out: >>> L ['h', 'e', 'l', 'l', 'o'] >>> for c in L: if c=3D=3D'l': L.remove(c) >>> L ['h', 'e', 'l', 'o'] In other words, even though I intended to remove BOTH 'l' characters, only one of them was removed because deleting one caused me to skip the next element. I think this stuff is so fraught with potential errors by the user, even if YOU get it right, that I'd prefer to just ban the practice and make people use a "filter" concept like in python, or a remove_if as in STL. Kent Carsten Orthbandt wrote: > I'm currently building a small scripting language for interactive = stuff. Now I > know there's plenty out there, I'm just doing this for fun. >=20 > A tricky question came up and I'd like to collect opinions and = experiences on > this. It's about foreach for dynamic arrays. Consider this C++-like = pseudo code: >=20 > DynamicArray<int> list; > int i; > for(i=3D0;i<20;i++){list.Add(i);}; > foreach(i in list){ > print(i); > if(i=3D=3D8){list.Delete(12);}; > }; >=20 > The obvious question is how should an active iterator react if the = traversed list > changes? To answer this, I simply tried it out in two languages I know = that do > provide both dynamic arrays and foreach: STL, Tcl and C#. >=20 > In STL C++ code, I get an exception because of iterator = incompatibility. > In Tcl this problem isn't one because the iterator takes a snapshot of = the list > object on start and there's no language construct to actually change = this instance. > In C# with the List<int> generic, I get an exception because the = iterated object > changes (interestingly, this happens on ANY change to the list, even = appending). >=20 > Now what I'd like to know: > - how do other languages cope with this? (Tcl doesn't need to, C++/C# = simply fails) > - what do YOU think would be sensible behaviour? >=20 > Currently I'm considering having all iterators be elements of a = double-linked list > and let the array object be the dl-list head. So if the number of = array elements > changes, it can run through all attached iterators and fix their = indices or stop them. >=20 > =20 -------------------------------------------------------------------------= Using Tomcat but need to do more? Need to support web services, = security? Get stuff done quickly with pre-integrated technology to make your job = easier Download IBM WebSphere Application Server v.1.0.1 based on Apache = Geronimo http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D= 121642 _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 |
From: Kent Q. <ken...@co...> - 2006-08-13 02:39:31
|
In Python, I was shocked to find that this succeeds: L = range(20) for i in L: print i if i==4: del L[6] Result: ------- 0 1 2 3 4 5 7 8 9 I fully expected it to fail. I consider messing with the list you're traversing with an iterator to be on a par with sawing off the branch you're standing on, unless, as you imply, the list is known to be implemented as a linked list. In python, you can surprise yourself. Consider this: for i in L: print i if i==4: del L[3] # delete one of the items BEFORE the one you're on 0 1 2 3 4 6 7 8 9 So what happened is that we ended up skipping element #5, even though we deleted element 3. This is really dependent on the implementation details of the particular interpreter, and probably isn't guaranteed by the average language spec. If you feel strongly about being able to do this, you have to deal with the case of deleting the item you're on right now, and also about deleting the last element while you're at the last element. Check this out: >>> L ['h', 'e', 'l', 'l', 'o'] >>> for c in L: if c=='l': L.remove(c) >>> L ['h', 'e', 'l', 'o'] In other words, even though I intended to remove BOTH 'l' characters, only one of them was removed because deleting one caused me to skip the next element. I think this stuff is so fraught with potential errors by the user, even if YOU get it right, that I'd prefer to just ban the practice and make people use a "filter" concept like in python, or a remove_if as in STL. Kent Carsten Orthbandt wrote: > I'm currently building a small scripting language for interactive stuff. Now I > know there's plenty out there, I'm just doing this for fun. > > A tricky question came up and I'd like to collect opinions and experiences on > this. It's about foreach for dynamic arrays. Consider this C++-like pseudo code: > > DynamicArray<int> list; > int i; > for(i=0;i<20;i++){list.Add(i);}; > foreach(i in list){ > print(i); > if(i==8){list.Delete(12);}; > }; > > The obvious question is how should an active iterator react if the traversed list > changes? To answer this, I simply tried it out in two languages I know that do > provide both dynamic arrays and foreach: STL, Tcl and C#. > > In STL C++ code, I get an exception because of iterator incompatibility. > In Tcl this problem isn't one because the iterator takes a snapshot of the list > object on start and there's no language construct to actually change this instance. > In C# with the List<int> generic, I get an exception because the iterated object > changes (interestingly, this happens on ANY change to the list, even appending). > > Now what I'd like to know: > - how do other languages cope with this? (Tcl doesn't need to, C++/C# simply fails) > - what do YOU think would be sensible behaviour? > > Currently I'm considering having all iterators be elements of a double-linked list > and let the array object be the dl-list head. So if the number of array elements > changes, it can run through all attached iterators and fix their indices or stop them. > > |
From: Carsten O. <car...@se...> - 2006-08-12 13:46:14
|
I'm currently building a small scripting language for interactive stuff. = Now I know there's plenty out there, I'm just doing this for fun. =20 A tricky question came up and I'd like to collect opinions and = experiences on this. It's about foreach for dynamic arrays. Consider this C++-like = pseudo code: =20 DynamicArray<int> list; int i; for(i=3D0;i<20;i++){list.Add(i);}; foreach(i in list){ print(i); if(i=3D=3D8){list.Delete(12);}; }; =20 The obvious question is how should an active iterator react if the = traversed list changes? To answer this, I simply tried it out in two languages I know = that do provide both dynamic arrays and foreach: STL, Tcl and C#. =20 In STL C++ code, I get an exception because of iterator incompatibility. In Tcl this problem isn't one because the iterator takes a snapshot of = the list object on start and there's no language construct to actually change = this instance. In C# with the List<int> generic, I get an exception because the = iterated object changes (interestingly, this happens on ANY change to the list, even = appending). =20 Now what I'd like to know: - how do other languages cope with this? (Tcl doesn't need to, C++/C# = simply fails) - what do YOU think would be sensible behaviour? =20 Currently I'm considering having all iterators be elements of a = double-linked list and let the array object be the dl-list head. So if the number of array = elements changes, it can run through all attached iterators and fix their indices = or stop them. =20 =20 Carsten Orthbandt Founder + Development Director SEK SpieleEntwicklungsKombinat GmbH http://www.sek-ost.de Wenn ich Visionen habe, gehe ich zum Arzt. - Helmut Schmidt =20 =20 |
From: Alen L. <ale...@cr...> - 2006-08-11 07:20:22
|
Hi Research, Have you tried just doing _spawnvp() and then _cwait()? It seems to work correctly for me. Also, I believe that system() might do the same, but you'd have to check if it might create a temporary console window, what is certainly not what you want. Cheers, Alen Research wrote: > Hi, > According to > http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/Simplifying_Game_Installation.asp > it is recommended to do a silent install of DirectX, but we're having > trouble making this work. > Our game doesn't need to be installed, so we're running stright from CD. > When the CD is inserted, or the application launched, a "launcher" dialog is > displayed. If the player clicks "play", then we are calling: > ShellExecute(NULL, "open", "DirectX/dxsetup.exe", "/silent", NULL, > SW_SHOWNORMAL); > But this call doesn't seem to block and returns immediately, so if the > player didn't already have the latest DX installed, it would be partway > through installation when the game launched and of course this doesn't work. > Is there a way or API to run a program and block until it finishes? > Thanks, > Brett Bibby > GameBrains > ------------------------------------------------------------------------- > Using Tomcat but need to do more? Need to support web services, security? > Get stuff done quickly with pre-integrated technology to make your job easier > Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=555 -- Alen |
From: Mat N. \(BUNGIE\) <Mat...@mi...> - 2006-08-11 04:21:37
|
[Assuming the filters let this through...] =20 You should be able to use ShellExecuteEx with SEE_MASK_NOCLOSEPROCESS = and then call WaitForSingleObject on the returned process handle. =20 MSN ________________________________ From: gam...@li... on behalf of = Research Sent: Thu 8/10/2006 7:15 PM To: Gam...@li... Subject: [GD-Windows] Silent DirectX Installation Hi, According to http://msdn.microsoft.com/library/default.asp?url=3D/library/en-us/direct= x9_c/Simplifying_Game_Installation.asp it is recommended to do a silent install of DirectX, but we're having trouble making this work. Our game doesn't need to be installed, so we're running stright from CD. When the CD is inserted, or the application launched, a "launcher" = dialog is displayed. If the player clicks "play", then we are calling: ShellExecute(NULL, "open", "DirectX/dxsetup.exe", "/silent", NULL, SW_SHOWNORMAL); But this call doesn't seem to block and returns immediately, so if the player didn't already have the latest DX installed, it would be partway through installation when the game launched and of course this doesn't = work. Is there a way or API to run a program and block until it finishes? Thanks, Brett Bibby GameBrains -------------------------------------------------------------------------= Using Tomcat but need to do more? Need to support web services, = security? Get stuff done quickly with pre-integrated technology to make your job = easier Download IBM WebSphere Application Server v.1.0.1 based on Apache = Geronimo http://sel.as-us.falkag.net/sel?cmd=3Dlnk&kid=3D120709&bid=3D263057&dat=3D= 121642 _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 |
From: Research <res...@ga...> - 2006-08-11 02:18:19
|
Hi, According to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/Simplifying_Game_Installation.asp it is recommended to do a silent install of DirectX, but we're having trouble making this work. Our game doesn't need to be installed, so we're running stright from CD. When the CD is inserted, or the application launched, a "launcher" dialog is displayed. If the player clicks "play", then we are calling: ShellExecute(NULL, "open", "DirectX/dxsetup.exe", "/silent", NULL, SW_SHOWNORMAL); But this call doesn't seem to block and returns immediately, so if the player didn't already have the latest DX installed, it would be partway through installation when the game launched and of course this doesn't work. Is there a way or API to run a program and block until it finishes? Thanks, Brett Bibby GameBrains |
From: Emmanuel A. <e_a...@ya...> - 2006-07-27 16:34:24
|
Hi, =20 590 is not he size of the alloca. This size is not known at compile time ( if it were, a mere array would be = better ). And actually, the alloca is not even called. =20 As for the _resetstkoflw, we did it, but it only must be used when dealing = with stack overflow issues, and we don't have any... =20 But thanks for your answer anyway... =20 =20 Emmanuel ----- Message d'origine ---- De : deldav <del...@fr...> =C3=80 : Emmanuel Astier <e_a...@ya...>; Game Development for MS Windo= ws <gam...@li...> Envoy=C3=A9 le : Jeudi, 27 Juillet 2006, 3h10mn 08s Objet : Re: [GD-Windows] Re : Strange prolog function issue alloca allocates its memory from the stack and that space is automatically = freed when the function returns. That's why the compiler mess with esp and ebp ... 590h should be the size o= f your alloca (perhaps rounded to keep stack alignement) Beware (from msdn): In Windows XP, if _alloca is called inside a try/catch block, you must = call _resetstkoflw in the catch block=20 Hope that helps. -----Message d'origine----- De : gam...@li... [mailto:gamedevlist= s-w...@li...] De la part de Emmanuel Astier Envoy=C3=A9 : mercredi 26 juillet 2006 01:13 =C3=80 : Game Development for MS Windows Objet : [GD-Windows] Re : Strange prolog function issue Hi,=20 It only happens in release build. And as you said, I suspect a compiler bug= . Actually, I don't understand when the compiler decide to switch to a differ= ent prolog for the function, where ebp doesn't have the same meaning. It is all fine as the function code knows the different ebp meaning, and ha= s no trouble accessing local vars, but the exception handler seems not to be aware of the change in the ebp meaning. Thanks for your help, we send a mail to microsoft, we will wait for their anwser... Emmanuel Ps : Kent, replying to your mails only replies to you, not to the list...= =20 ----- Message d'origine ---- De : Kent Quirk <ken...@co...> =C3=80 : Emmanuel Astier <e_astie= r...@ya...>; Game Development for MS Windows <gam...@li...> Envoy=C3=A9 le : Mardi, 25 Juillet 2006, 6h09mn 40s Objet : Re: [GD-Windows= ] Strange prolog function issue Emmanuel Astier wrote: > Hi all, > =20 > =20 > I have here a very strange issue. > =20 > We have a function using a local std::string, exceptions, and a alloca. > =20 > When the exception is thrown, the unwind mecanism tries to delete the std= ::string, but it deletes it at a wrong address( there is a 0x590 offset ). > =20 > <snip> > =20 > I could not reproduce this ebp offset that makes the exception handler fa= il in a small sample.=20 > So do you know in which case the compiler does not put esp in ebp, but pu= t an offset in it ? > And do you know how to fix it ( other than what we're doing : stopping us= ing alloca with exceptions ), if it is a kind a known issue ?=20 > =20 Does the bug occur in both debug and release builds? Have you tried setting= the optimization manually for that file? In any large project, I usually find a couple of files that drive some form of compiler = bug under full optimization, and I have to manually turn down the optimization on that particular file or do some sort of special (h= eavily commented!) adaptation, such as moving a function's location in the source = file, or in the header file. You might also try playing with a couple of exception-related compiler switches. Compilers are complic= ated beasts, and any project of a significant size is likely to drive a bug or two. ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's = Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDE= VDEV _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share you= r opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDE= VDEV _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 |
From: deldav <del...@fr...> - 2006-07-27 13:10:07
|
alloca allocates its memory from the stack and that space is = automatically freed when the function returns. That's why the compiler mess with esp and ebp ... 590h should be the = size of your alloca (perhaps rounded to keep stack alignement) Beware (from msdn): In Windows XP, if _alloca is called inside a try/catch block, you must = call _resetstkoflw in the catch block=20 Hope that helps. -----Message d'origine----- De : gam...@li... = [mailto:gam...@li...] De la part = de Emmanuel Astier Envoy=E9 : mercredi 26 juillet 2006 01:13 =C0 : Game Development for MS Windows Objet : [GD-Windows] Re : Strange prolog function issue Hi,=20 =20 It only happens in release build. And as you said, I suspect a compiler = bug. =20 Actually, I don't understand when the compiler decide to switch to a = different prolog for the function, where ebp doesn't have the same meaning. It is all fine as the function code knows the different ebp meaning, and = has no trouble accessing local vars, but the exception handler seems not to be aware of the change in the ebp meaning. =20 Thanks for your help, we send a mail to microsoft, we will wait for their anwser... =20 Emmanuel Ps : Kent, replying to your mails only replies to you, not to the = list...=20 ----- Message d'origine ---- De : Kent Quirk <ken...@co...> =C0 : Emmanuel Astier = <e_a...@ya...>; Game Development for MS Windows <gam...@li...> Envoy=E9 le : Mardi, 25 Juillet 2006, 6h09mn 40s Objet : Re: = [GD-Windows] Strange prolog function issue Emmanuel Astier wrote: > Hi all, > =20 > =20 > I have here a very strange issue. > =20 > We have a function using a local std::string, exceptions, and a = alloca. > =20 > When the exception is thrown, the unwind mecanism tries to delete the = std::string, but it deletes it at a wrong address( there is a 0x590 offset ). > =20 > <snip> > =20 > I could not reproduce this ebp offset that makes the exception handler = fail in a small sample.=20 > So do you know in which case the compiler does not put esp in ebp, but = put an offset in it ? > And do you know how to fix it ( other than what we're doing : stopping = using alloca with exceptions ), if it is a kind a known issue ?=20 > =20 Does the bug occur in both debug and release builds? Have you tried = setting the optimization manually for that file? In any large project, I usually find a couple of files that drive some form of = compiler bug under full optimization, and I have to manually turn down the optimization on that particular file or do some sort of special = (heavily commented!) adaptation, such as moving a function's location in the = source file, or in the header file. You might also try playing with a couple of exception-related compiler switches. Compilers are = complicated beasts, and any project of a significant size is likely to drive a bug or two. -------------------------------------------------------------------------= Take Surveys. Earn Cash. Influence the Future of IT Join = SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 |
From: Dan T. <da...@ar...> - 2006-07-26 22:03:59
|
Huh, I had heard frame pointer omission wasn't a huge optimization. We turned it off to get reliable stacks off of our release builds. A quick google doesn't mention much other than how to turn it off or that it affects ebp. Does anyone have any numbers on performance, or in what circumstances it makes a large difference? By the way, in VS8.0 "Optimize for Speed" and "Optimize for Size" both force enable frame pointer omission. From the docs: "The /Ox (Full Optimization) <http://msdn2.microsoft.com/en-us/library/59a3b321.aspx> (Full Optimization) and /O1, /O2 (Minimize Size, Maximize Speed) <http://msdn2.microsoft.com/en-us/library/8f8h5cxt.aspx> (Fast Code) options imply */Oy*. Specifying */Oy–* after the */Ox*, */O1*, or */O2* option disables */Oy*, whether it is explicit or implied." -Dan Kevin Wasserman wrote: > Make sure properties->optimization "omit frame pointers" is set to "No" for > your release build, otherwise the compiler will feel free to do what it > wants with ebp. > > My understanding was that if you ever use _alloca() in a function, though, > the compiler would be forced to use ebp as a frame pointer regardless > because of the exception handling cleanup issue. This was a strong reason > not to use _alloca because the "omit frame pointers" optimization can be a > quite significant performance gain. All this may have changed with 7.1, > however. > > -Kevin Wasserman > > >> Date: Tue, 25 Jul 2006 23:12:40 +0000 (GMT) >> From: Emmanuel Astier <e_a...@ya...> >> Subject: [GD-Windows] Re : Strange prolog function issue >> To: Game Development for MS Windows >> <gam...@li...> >> Message-ID: <200...@we...> >> Content-Type: text/plain; charset=utf-8 >> >> Hi, >> >> It only happens in release build. And as you said, I suspect a compiler >> bug. >> >> Actually, I don't understand when the compiler decide to switch to a >> different prolog for the function, where ebp doesn't have the same meaning. >> It is all fine as the function code knows the different ebp meaning, and >> has no trouble accessing local vars, but the exception handler seems not to >> be aware of the change in the ebp meaning. >> >> Thanks for your help, >> we send a mail to microsoft, we will wait for their anwser... >> >> Emmanuel >> >> Ps : Kent, replying to your mails only replies to you, not to the list... >> > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=555 > > > |
From: Kevin W. <krw...@ho...> - 2006-07-26 20:33:13
|
Make sure properties->optimization "omit frame pointers" is set to "No" for your release build, otherwise the compiler will feel free to do what it wants with ebp. My understanding was that if you ever use _alloca() in a function, though, the compiler would be forced to use ebp as a frame pointer regardless because of the exception handling cleanup issue. This was a strong reason not to use _alloca because the "omit frame pointers" optimization can be a quite significant performance gain. All this may have changed with 7.1, however. -Kevin Wasserman >Date: Tue, 25 Jul 2006 23:12:40 +0000 (GMT) >From: Emmanuel Astier <e_a...@ya...> >Subject: [GD-Windows] Re : Strange prolog function issue >To: Game Development for MS Windows > <gam...@li...> >Message-ID: <200...@we...> >Content-Type: text/plain; charset=utf-8 > >Hi, > >It only happens in release build. And as you said, I suspect a compiler >bug. > >Actually, I don't understand when the compiler decide to switch to a >different prolog for the function, where ebp doesn't have the same meaning. >It is all fine as the function code knows the different ebp meaning, and >has no trouble accessing local vars, but the exception handler seems not to >be aware of the change in the ebp meaning. > >Thanks for your help, >we send a mail to microsoft, we will wait for their anwser... > >Emmanuel > >Ps : Kent, replying to your mails only replies to you, not to the list... |
From: Emmanuel A. <e_a...@ya...> - 2006-07-25 23:12:48
|
Hi,=20 =20 It only happens in release build. And as you said, I suspect a compiler bug= . =20 Actually, I don't understand when the compiler decide to switch to a differ= ent prolog for the function, where ebp doesn't have the same meaning. It is all fine as the function code knows the different ebp meaning, and ha= s no trouble accessing local vars, but the exception handler seems not to b= e aware of the change in the ebp meaning. =20 Thanks for your help,=20 we send a mail to microsoft, we will wait for their anwser... =20 Emmanuel Ps : Kent, replying to your mails only replies to you, not to the list...= =20 ----- Message d'origine ---- De : Kent Quirk <ken...@co...> =C3=80 : Emmanuel Astier <e_a...@ya...>; Game Development for MS Windo= ws <gam...@li...> Envoy=C3=A9 le : Mardi, 25 Juillet 2006, 6h09mn 40s Objet : Re: [GD-Windows] Strange prolog function issue Emmanuel Astier wrote: > Hi all,=20 > =20 > =20 > I have here a very strange issue. > =20 > We have a function using a local std::string, exceptions, and a alloca. > =20 > When the exception is thrown, the unwind mecanism tries to delete the std= ::string, but it deletes it at a wrong address( there is a 0x590 offset ). > =20 > <snip>=20 > =20 > I could not reproduce this ebp offset that makes the exception handler fa= il in a small sample.=20 > So do you know in which case the compiler does not put esp in ebp, but pu= t an offset in it ? > And do you know how to fix it ( other than what we're doing : stopping us= ing alloca with exceptions ), if it is a kind a known issue ?=20 > =20 Does the bug occur in both debug and release builds? Have you tried=20 setting the optimization manually for that file? In any large project,=20 I usually find a couple of files that drive some form of compiler bug=20 under full optimization, and I have to manually turn down the=20 optimization on that particular file or do some sort of special (heavily=20 commented!) adaptation, such as moving a function's location in the=20 source file, or in the header file. You might also try playing with a=20 couple of exception-related compiler switches. Compilers are complicated=20 beasts, and any project of a significant size is likely to drive a bug=20 or two. |
From: Kent Q. <ken...@co...> - 2006-07-25 16:10:17
|
Emmanuel Astier wrote: > Hi all, > > > I have here a very strange issue. > > We have a function using a local std::string, exceptions, and a alloca. > > When the exception is thrown, the unwind mecanism tries to delete the std::string, but it deletes it at a wrong address( there is a 0x590 offset ). > > <snip> > > I could not reproduce this ebp offset that makes the exception handler fail in a small sample. > So do you know in which case the compiler does not put esp in ebp, but put an offset in it ? > And do you know how to fix it ( other than what we're doing : stopping using alloca with exceptions ), if it is a kind a known issue ? > Does the bug occur in both debug and release builds? Have you tried setting the optimization manually for that file? In any large project, I usually find a couple of files that drive some form of compiler bug under full optimization, and I have to manually turn down the optimization on that particular file or do some sort of special (heavily commented!) adaptation, such as moving a function's location in the source file, or in the header file. You might also try playing with a couple of exception-related compiler switches. Compilers are complicated beasts, and any project of a significant size is likely to drive a bug or two. |
From: Emmanuel A. <e_a...@ya...> - 2006-07-25 11:44:20
|
Hi,=20 =20 Thanks for your answer, but this is not the case. It came after a rebuild of all our project, with all our libs... =20 As a side note, we're using VC7.1, but as we have the latest Xenon XDK, I t= hink the compiler is vc 2005. =20 =20 Emmanuel =20 =20 =20 ----- Message d'origine ---- De : Jamie Fowlston <ja...@qu...> =C3=80 : Game Development for MS Windows <gam...@li...urce= forge.net> Envoy=C3=A9 le : Mardi, 25 Juillet 2006, 1h20mn 11s Objet : Re: [GD-Windows] Strange prolog function issue Emmanuel Astier wrote: > So do you know in which case the compiler does not put esp in ebp, but pu= t an offset in it ? > And do you know how to fix it ( other than what we're doing : stopping us= ing alloca with exceptions ), if it is a kind a known issue ? Last time I saw anything like that on Windows was (IIRC) when we were=20 switching from VC 7.0 to 7.1 (might have been 6.0 to 7.0). If we had a=20 mixed build (i.e. libs built with one version, app with another), you'd=20 get strange things happening at the interfaces, where the compilers just=20 wouldn't agree with each other as to what they should be doing. May well not be your problem, though. Jamie ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share you= r opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3DDE= VDEV _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 |
From: Jamie F. <ja...@qu...> - 2006-07-25 11:19:28
|
Emmanuel Astier wrote: > So do you know in which case the compiler does not put esp in ebp, but put an offset in it ? > And do you know how to fix it ( other than what we're doing : stopping using alloca with exceptions ), if it is a kind a known issue ? Last time I saw anything like that on Windows was (IIRC) when we were switching from VC 7.0 to 7.1 (might have been 6.0 to 7.0). If we had a mixed build (i.e. libs built with one version, app with another), you'd get strange things happening at the interfaces, where the compilers just wouldn't agree with each other as to what they should be doing. May well not be your problem, though. Jamie |
From: Emmanuel A. <e_a...@ya...> - 2006-07-25 10:09:06
|
Hi all, I have here a very strange issue. We have a function using a local std::string, exceptions, and a alloca. When the exception is thrown, the unwind mecanism tries to delete the std::string, but it deletes it at a wrong address( there is a 0x590 offset ). We debugged this problem for two days, and it only happens when the alloca is present. In this case, the prolog of the function is of this type : 00F60F00 push ebp 00F60F01 lea ebp,[esp-590h] ***** NOTICE THE STRANGE EBP VALUE HERE 00F60F08 push 0FFFFFFFFh 00F60F0A push offset __ehhandler$?CompileOneVariableDeclaration@AIE_cl_Compiler@@AAEXXZ (139B888h) 00F60F0F mov eax,dword ptr fs:[00000000h] 00F60F15 push eax 00F60F16 mov dword ptr fs:[0],esp 00F60F1D sub esp,5ECh 00F60F23 mov eax,dword ptr [___security_cookie (16A1EECh)] 00F60F28 push ebx 00F60F29 push esi 00F60F2A mov dword ptr [ebp+580h],eax 00F60F30 push edi 00F60F31 mov ebx,ecx As without the alloca, the prolog is like : 00402580 push ebp 00402581 mov ebp,esp *********** HERE, AS ALWAYS, EBP IS SET TO ESP 00402583 push 0FFFFFFFFh 00402585 push offset __ehhandler$?MyFunc@@YAXXZ (420738h) 0040258A mov eax,dword ptr fs:[00000000h] 00402590 push eax 00402591 mov dword ptr fs:[0],esp 00402598 sub esp,34h 0040259B mov eax,dword ptr [___security_cookie (429608h)] 004025A0 push ebx 004025A1 push esi 004025A2 mov dword ptr [ebp-10h],eax 004025A5 push edi Note that in our crashing case, ebp is set to esp - 590 ( the offset value ), and that in the other case, it is just set to esp. I could not reproduce this ebp offset that makes the exception handler fail in a small sample. So do you know in which case the compiler does not put esp in ebp, but put an offset in it ? And do you know how to fix it ( other than what we're doing : stopping using alloca with exceptions ), if it is a kind a known issue ? Thanks for any help, Emmanuel |
From: Research <res...@ga...> - 2006-07-25 08:54:03
|
Okay, it looks like it returns SE_ERR_NOASSOC which looks like it can wor= k.=20 Thanks for the help! ----- Original Message -----=20 From: "Jurjen Katsman" <jka...@ni...> To: "'Game Development for MS Windows'"=20 <gam...@li...> Sent: Tuesday, July 25, 2006 4:40 PM Subject: Re: [GD-Windows] detecting installed application > I'm pretty sure it does. There is a specific return code to indicate th= at > there is no known binding for a specific type of file. (E_NOASSOC or > something?) > > -----Oorspronkelijk bericht----- > Van: gam...@li... > [mailto:gam...@li...] Namens=20 > Research > Verzonden: dinsdag 25 juli 2006 10:36 > Aan: Game Development for MS Windows > Onderwerp: Re: [GD-Windows] detecting installed application > > I thought it would pop up that dialog that asks how to choose which > application to open the file. I didn't think it would fail and return > control to me. I'll check on this though... > > ----- Original Message -----=20 > From: "Dirk Ringe" <ri...@ph...> > To: "Game Development for MS Windows" > <gam...@li...> > Sent: Tuesday, July 25, 2006 4:32 PM > Subject: Re: [GD-Windows] detecting installed application > > >> What happens if you run the PDF document via the ShellExecute command=20 >> when > >> no PDF reader is installed? Does the command fail or is the user annoy= ed >> with the choose your application dialog? If you can make the command f= ail >> then that would be the most secure check whether acrobat is installed.= .. >> >> Dirk >> >> -----Urspr=FCngliche Nachricht----- >> Von: gam...@li... >> [mailto:gam...@li...] Im Auftrag= =20 >> von > >> Research >> Gesendet: Dienstag, 25. Juli 2006 10:13 >> An: Gam...@li... >> Betreff: [GD-Windows] detecting installed application >> >> Hi, >> Is there an easy way to detect whether a specific application is=20 >> installed >> in Windows? >> >> Our game runs from the CD tray (no install) and I want to provide a li= nk >> to >> our PDF manual. If the player has Acrobat installed, I want to open th= e >> file, it they don't have acrobat installed, I want to ask the player i= f >> they >> want it installed or not. So I need some way to detect whether Acrobat= is >> already installed. >> >> Cheers, >> Brett >> >> >> ----------------------------------------------------------------------= --- >> Take Surveys. Earn Cash. Influence the Future of IT >> Join SourceForge.net's Techsay panel and you'll get the chance to shar= e >> your >> opinions on IT & business topics through brief surveys -- and earn cas= h >> http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID= =3DDEVDEV >> _______________________________________________ >> Gamedevlists-windows mailing list >> Gam...@li... >> https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows >> Archives: >> http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 >> >> >> >> ----------------------------------------------------------------------= --- >> Take Surveys. Earn Cash. Influence the Future of IT >> Join SourceForge.net's Techsay panel and you'll get the chance to shar= e >> your >> opinions on IT & business topics through brief surveys -- and earn cas= h >> http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID= =3DDEVDEV >> _______________________________________________ >> Gamedevlists-windows mailing list >> Gam...@li... >> https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows >> Archives: >> http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 >> >> > > > -----------------------------------------------------------------------= -- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share= =20 > your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 > > > -----------------------------------------------------------------------= -- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share= =20 > your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 >=20 |
From: Jurjen K. <jka...@ni...> - 2006-07-25 08:40:45
|
I'm pretty sure it does. There is a specific return code to indicate = that there is no known binding for a specific type of file. (E_NOASSOC or something?) -----Oorspronkelijk bericht----- Van: gam...@li... [mailto:gam...@li...] Namens = Research Verzonden: dinsdag 25 juli 2006 10:36 Aan: Game Development for MS Windows Onderwerp: Re: [GD-Windows] detecting installed application I thought it would pop up that dialog that asks how to choose which=20 application to open the file. I didn't think it would fail and return=20 control to me. I'll check on this though... ----- Original Message -----=20 From: "Dirk Ringe" <ri...@ph...> To: "Game Development for MS Windows"=20 <gam...@li...> Sent: Tuesday, July 25, 2006 4:32 PM Subject: Re: [GD-Windows] detecting installed application > What happens if you run the PDF document via the ShellExecute command = when > no PDF reader is installed? Does the command fail or is the user = annoyed=20 > with the choose your application dialog? If you can make the command = fail=20 > then that would be the most secure check whether acrobat is = installed... > > Dirk > > -----Urspr=FCngliche Nachricht----- > Von: gam...@li...=20 > [mailto:gam...@li...] Im Auftrag = von > Research > Gesendet: Dienstag, 25. Juli 2006 10:13 > An: Gam...@li... > Betreff: [GD-Windows] detecting installed application > > Hi, > Is there an easy way to detect whether a specific application is = installed > in Windows? > > Our game runs from the CD tray (no install) and I want to provide a = link=20 > to > our PDF manual. If the player has Acrobat installed, I want to open = the > file, it they don't have acrobat installed, I want to ask the player = if=20 > they > want it installed or not. So I need some way to detect whether Acrobat = is > already installed. > > Cheers, > Brett > > > = -------------------------------------------------------------------------= > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to = share=20 > your > opinions on IT & business topics through brief surveys -- and earn = cash > = http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 > > > > = -------------------------------------------------------------------------= > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to = share=20 > your > opinions on IT & business topics through brief surveys -- and earn = cash > = http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 > >=20 -------------------------------------------------------------------------= Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share = your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 |
From: Research <res...@ga...> - 2006-07-25 08:38:34
|
I thought it would pop up that dialog that asks how to choose which=20 application to open the file. I didn't think it would fail and return=20 control to me. I'll check on this though... ----- Original Message -----=20 From: "Dirk Ringe" <ri...@ph...> To: "Game Development for MS Windows"=20 <gam...@li...> Sent: Tuesday, July 25, 2006 4:32 PM Subject: Re: [GD-Windows] detecting installed application > What happens if you run the PDF document via the ShellExecute command w= hen=20 > no PDF reader is installed? Does the command fail or is the user annoye= d=20 > with the choose your application dialog? If you can make the command fa= il=20 > then that would be the most secure check whether acrobat is installed... > > Dirk > > -----Urspr=FCngliche Nachricht----- > Von: gam...@li...=20 > [mailto:gam...@li...] Im Auftrag = von=20 > Research > Gesendet: Dienstag, 25. Juli 2006 10:13 > An: Gam...@li... > Betreff: [GD-Windows] detecting installed application > > Hi, > Is there an easy way to detect whether a specific application is instal= led > in Windows? > > Our game runs from the CD tray (no install) and I want to provide a lin= k=20 > to > our PDF manual. If the player has Acrobat installed, I want to open the > file, it they don't have acrobat installed, I want to ask the player if= =20 > they > want it installed or not. So I need some way to detect whether Acrobat = is > already installed. > > Cheers, > Brett > > > -----------------------------------------------------------------------= -- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share= =20 > your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 > > > > -----------------------------------------------------------------------= -- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share= =20 > your > opinions on IT & business topics through brief surveys -- and earn cash > http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 > >=20 |
From: Dirk R. <ri...@ph...> - 2006-07-25 08:32:39
|
What happens if you run the PDF document via the ShellExecute command = when no PDF reader is installed? Does the command fail or is the user = annoyed with the choose your application dialog? If you can make the = command fail then that would be the most secure check whether acrobat is = installed... Dirk=20 -----Urspr=FCngliche Nachricht----- Von: gam...@li... = [mailto:gam...@li...] Im Auftrag = von Research Gesendet: Dienstag, 25. Juli 2006 10:13 An: Gam...@li... Betreff: [GD-Windows] detecting installed application Hi, Is there an easy way to detect whether a specific application is = installed=20 in Windows? Our game runs from the CD tray (no install) and I want to provide a link = to=20 our PDF manual. If the player has Acrobat installed, I want to open the=20 file, it they don't have acrobat installed, I want to ask the player if = they=20 want it installed or not. So I need some way to detect whether Acrobat = is=20 already installed. Cheers, Brett=20 -------------------------------------------------------------------------= Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share = your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=3Djoin.php&p=3Dsourceforge&CID=3D= DEVDEV _______________________________________________ Gamedevlists-windows mailing list Gam...@li... https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=3D555 |
From: Research <res...@ga...> - 2006-07-25 08:15:31
|
Hi, Is there an easy way to detect whether a specific application is installed in Windows? Our game runs from the CD tray (no install) and I want to provide a link to our PDF manual. If the player has Acrobat installed, I want to open the file, it they don't have acrobat installed, I want to ask the player if they want it installed or not. So I need some way to detect whether Acrobat is already installed. Cheers, Brett |