Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Keith Thompson Newsgroups: comp.lang.c Subject: Re: memcpy not memcpying? Date: Fri, 01 Nov 2019 10:19:09 -0700 Organization: None to speak of Lines: 20 Message-ID: References: <2LVuF.7$BF1.0@fx26.iad> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: reader02.eternal-september.org; posting-host="bd2070be1949be0113457798c3cfb24b"; logging-data="1127"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+cnXj7t5Hc4H+N4sim3uEs" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) Cancel-Lock: sha1:skNlIxLgIV84uF4pv0b1O8z+jgs= sha1:Mdj8bkkmK966nLstHrJHqDjxMC8= Xref: csiph.com comp.lang.c:147473 DFS writes: [...] > printf("%d\n",sizeof(char*)); > 8 sizeof yields a result of type size_t. Use "%zu", not "%d". Using "%d" can appear to work depending on how arguments are passed, but it's unreliable. If remembering all the formats is too much trouble (it is for me sometimes), you can convert to a type that you know how to print and that you're confident is wide enough to hold the value: printf("%lu\n", (unsigned long)sizeof(char*)); -- Keith Thompson (The_Other_Keith) kst-u@mib.org Working, but not speaking, for Philips Healthcare void Void(void) { Void(); } /* The recursive call of the void */