* Kim F. Storm (2006-07-21) writes:

> Ralf Angeli <[EMAIL PROTECTED]> writes:
>
>> +  left = w32_get_arg (Qnil, Qleft, "left", "Left", RES_TYPE_NUMBER);
>> +  if (!EQ (left, Qunbound))
>> +    CHECK_NUMBER (left);
>
>> One gripe I have with it is that the CHECK_NUMBER macro does not seem
>> to work.  If I use a string for the `top' or `left' property no error
>> is thrown.  Does anybody know why?
>
> You pass RES_TYPE_NUMBER to w32_get_arg, which is
> evaluated like this:
>
>           case RES_TYPE_NUMBER:
>             return make_number (atoi (SDATA (tem)));
>
> so if the value is not a number, atoi returns zero.

Oh, I see.  Thanks for the info.  Then I'll have to use
RES_TYPE_STRING if I wanted to catch erroneous values.  It's probably
not worth the trouble anyway because a fallback of 0 is not too bad.

The reason I even got the idea of using CHECK_NUMER is code in x_icon
(in w32fns.c), which also uses w32_get_arg with RES_TYPE_NUMBER and
checks with CHECK_NUMBER afterwards.  I guess this is a useless check
either.

-- 
Ralf


_______________________________________________
emacs-pretest-bug mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/emacs-pretest-bug

Reply via email to