I often employ a design pattern of for each item in a list where the list is a typdef enumerated type. This is a great way of making a linear sequence where each item is tested one time (test sequences, list checking .....). I used to make an array of the type and populate it with one of each item, this is not very scalable since when I change the typdef I have to redo the list. Instead I do a little type manupulation to make sure that I itterate one time for each intem in my enum, this requires some support code and extra wiring. It would be nice if I could make a for loop that takes the enyumerated type and used it as its itterator. See below:
The new for loop which takes an enum would greatly simplify the code readability.
I use this all the time and find it to work great, uppdate my enum and handle the new case, no chance of missing a case (I use it in conjunction with case structures with no defaults so my code breaks and forces me to handle the new case.
I have attached the code if any one is interested
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.