CompuServe Thread

#exec lists

3 messages in this thread
#42216From: jack yorkAug 13, 1994 7:53 PM
I am using exec list handling functions to handle three separate lists. As the program stands now, there are three sets of functions that are basically the same; three add-to-list functions, three sort functions, etc. Is there a way to have one function perform the same job for each list. The problem is that each list has a different type of structure attached to it and I cannot figure out how to cast to three different types within the same function. I suppose I could do it with a lot of if statements but that doesn't seem much better than what I am doing now. Any suggestions will be appreciated. Thanks, Jack
#42227From: Brian BartlettAug 15, 1994 2:35 AM
Jack, if you were using C++ it'd be easy. Since you are using straight C, have you give thought to having an extra parameter in your generic function call? The parameter would specify which of the various list types that you are dealing with at call-time. Just a thought. "You do trust me, don't you? Of course you do." — "To Play the King" (BBC)
#42315From: jack yorkAug 20, 1994 7:23 PM
Thanks Brian. I played around with that idea a little but it seemed that all I was really doing was moving all of the code into one fcn since I still had to have different statements for each call to GetSucc,for example.