jonm / SillyMUD

SillyMUD, a derivative of DikuMud
Other
8 stars 5 forks source link

Separate out temporary index from type-specific index creation. #76

Closed jonm closed 8 years ago

jonm commented 8 years ago

It turns out that not the right thing was going on here. The intent was that the initial call to generate_indices would populate top_of_mobt or top_of_objt, which would then be passed as the second argument to either make_mob_indices or make_obj_indices. This works locally for me on Mac OS X with the Apple LLVM-based gcc.

However, when running on the prod Linux machine when compiled with gcc 4.8.3, the order of operations doesn't come out right. In this case, the original value for top_of_mobt or top_of_objt gets passed in: 0, and hence the new indices don't get created correctly.

By un-lining the call to generate_indices we can make sure it is unambiguous what order we want these to happen in.

dangitall commented 8 years ago

Interesting. Good find. I do not understand why this is necessary as my understanding is that the , should be a sequence point. But whatever, thanks for finding it.

jonm commented 8 years ago

¯(ツ)

dangitall commented 8 years ago

For completeness: a comma in an arg list is not a sequence point, so the behavior I introduced was (as observed) undefined.