[Plib-devel] "setValuator" in PUI
Brought to you by:
sjbaker
From: Fay J. F C. AAC/W. <joh...@eg...> - 2000-08-30 21:16:54
|
I have been looking at the "setValuator" functions in the PUI part of PLIB. It occurs to me that if the user calls "setValuator" with a pointer-to-float argument and then calls it again with a pointer-to-integer argument, he will get some strange results. Specifically, his integer variable will be overwritten with the integer equivalent of his floating-point variable, both immediately and whenever "getValue" is called. First question: is this a problem? Ideally the user would be careful enough to know what's going on. I'm hard pressed to think of any circumstances where this behavior is desirable. If the answer is yes, this is a problem, then I suggest that we modify the "setValuator" functions (pu.h, line 390 or so) as follows: void setValuator ( int *i ) { res_integer = i ; res_floater = NULL ; res_string = NULL ; re_eval () ; } void setValuator ( float *f ) { res_integer = NULL ; res_floater = f ; res_string = NULL ; re_eval () ; } void setValuator ( char *s ) { res_integer = NULL ; res_floater = NULL ; res_string = s ; re_eval () ; } John F. Fay joh...@eg... |