From mboxrd@z Thu Jan 1 00:00:00 1970 To: 9fans@cse.psu.edu From: "Douglas A. Gwyn" Message-ID: <3DD42027.8FFBAB70@null.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit References: <3DD3D463.BE431AC7@arl.army.mil>, Subject: Re: [9fans] how to avoid a memset() optimization Date: Fri, 15 Nov 2002 10:50:15 +0000 Topicbox-Message-UUID: 214f1326-eacb-11e9-9e20-41e7f4b1d025 Tad Hunt wrote: > void* > secmemset(void *buf, int v, int len) > { > return memset((volatile void*)buf, v, len); > } > However, isn't GCC going to complain that you're passing > a volatile to a function that isn't expecting a volatile? In standard-conforming mode it is *obliged* to issue a diagnostic. However, it can (and probably does) still generate code. Since this diagnostic would occur only once (when putting secmemset into some library) it wouldn't be as big a deal as if it occurred for every program that used secmemset.