Hi!

10-Фев-2004 13:56 [EMAIL PROTECTED] (Luchezar Georgiev) wrote to FreeDOS-kernel
<[EMAIL PROTECTED]>:

LG> +/* disable "lvalue cast is not standard C" (it's for legacy pre-ANSI code)
LG> */
LG> +#pragma disable_message(120)

     Under WPP this is error (E591, to be precise).

LG> +void memset(void *s, int c, size_t n)
LG>   {
LG> +  while(n--)
LG> +    *((char *)s)++ = c;
LG>   }

     This may written as "*(char*)s++", but here is trouble with such code
(because casted value isn't lvalue). Fortunately, here two solutions. First:

#define memset(s,c,n) memset_ ((void*)s,c,n)    /* PROTO.H */
void memset_ (byte *s, byte c, size_t n);       /* PROTO.H and MAIN.C */

Second:

void memset(void *s, int c, size_t n)
{
  while(n--)
    *(byte*)s = c, s = (byte*)s + 1;
}

PS: Lucho, do you seen my letters?!




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
Freedos-kernel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freedos-kernel

Reply via email to