I have a predicament. Im trying to standardize PMs error messages - TopicsExpress



          

I have a predicament. Im trying to standardize PMs error messages and Ive come up with 3 possible routes to doing so. Im after passing a sprintf-formatted string to the function (e.g. Limit: %1d, Needed: %1d) for which sprintf needs to convert those into actual digits (and its not always integers - the types vary). I cant just %s this into a string, itll just be copied as is. Since local variables are often involved and the error function is separate, I cant reference those as is so I need to copy them in some form or another. The first route is probably the most straight forward - have the function that displays the error message accept an infinite number of parameters where the globals and locals are passed to this function. The problem with this is that I wont readily know what type of variable is referenced. One call to the function might have the order as int, int (like my example above) but a different call might have it as double, int, double, double, unsigned int and yet a different call might have it as unsigned char, double, int, double, double, __int64, unsigned char, unsigned int. The second route is less direct - have a series of global variables that I simply copy the local variables into. The problem with this is that I wont know the correct order. The third route will require more lines but is the most direct - call sprintf to store the numbers into global strings then just %s them in. The problem with this is that it will use more lines, possibly 200+ more. What would you suggest as the best approach to this?
Posted on: Fri, 24 Oct 2014 17:05:59 +0000

Trending Topics



Recently Viewed Topics




© 2015