On Tue, 25 Sep 2001, Keith Packard wrote:

>>     (void) sprintf(openLicenseString, "%s:%d",
>>                    LICENSE_METHOD_OPEN,
>>                    OPEN_LICENSE_VERSION);
>>     openLicenseMethod = XInternAtom(dpy, openLicenseString, True);
>> 
>> Since the return code of sprintf is not actually used for 
>> anything... what is the purpose of casting it to void?
>
>Casting to void tells the compiler you *know* you're not looking at the
>result.  As sprintf does generate one, the compiler can emit a warning when
>the code fails to use it.  This might help reduce the number of untested
>error returns.  Or increase the number of (void) casts, which doesn't seem 
>like a feature either.

Hmm.  Looks to me like the programmer probably tried to silence 
the warning resulting from the lack of inclusion of stdio.h by 
adding (void) then..

Any idea where one would plop in a #include to have 
<DPS/dpsclient.h> included in all the files that emit warnings 
because it isn't there?

Thanks Keith,
TTYL

----------------------------------------------------------------------
Mike A. Harris                  Shipping/mailing address:
OS Systems Engineer             190 Pittsburgh Ave., Sault Ste. Marie,
XFree86 maintainer              Ontario, Canada, P6C 5B3
Red Hat Inc.                    Phone: (705)949-2136
http://www.redhat.com           ftp://people.redhat.com/mharris

Red Hat XFree86 mailing list:   [EMAIL PROTECTED]
IRC:  #redhat-xfree86 on irc.openprojects.org
----------------------------------------------------------------------
[EMAIL PROTECTED]:~#  rm -f /bin/laden

_______________________________________________
Xpert mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/xpert

Reply via email to