[PD-dev] pointer cast fix

Dan Wilcox danomatika at gmail.com
Fri Jan 21 20:31:57 CET 2022


I'd like to fix a few warnings but I want to double check the cast.

The warnings come from creating object hex names from pointers. sys_vgui() doesn't trigger this warning, but sprintf() does. For example:

../src/x_text.c:101:31: warning: format specifies type 'unsigned long' but the argument has type 't_textbuf *' (aka 'struct _textbuf *') [-Wformat]
        sprintf(buf, ".x%lx", x);

Would it be safe to do a cast to (unsigned long)?

sprintf(buf, ".x%lx", (unsigned long)x);

--------
Dan Wilcox
@danomatika <http://twitter.com/danomatika>
danomatika.com <http://danomatika.com/>
robotcowboy.com <http://robotcowboy.com/>



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20220121/2f90b529/attachment.htm>


More information about the Pd-dev mailing list