why gets "invalidate_cache" a const void ptr?

Thomas Dörfler Thomas.Doerfler at embedded-brains.de
Fri Apr 9 17:05:23 UTC 2010


Hi,

I just tripped over a strange thing: the "*invalidate_*_cache" functions
in cpukit/rtems/rtems/include/rtems/cache.h are declared to get a "const
void *" pointer passed in. IMHO the "const" is wrong, because the
function may modify the storage where the pointer points to

Background:
1.) when a cache line is invalidated, the real memory behind it may
become visible and have a different content than available in the cache
previously.

2.) Having that function to get a "const void *" allos GCC to use more
optimizations, which may result in wrong code.

what do you all think?

I would vote to remove the "const" keyword in the declaration and the
implementations of the functions.
wkr,
Thomas.

-- 

--------------------------------------------
Embedded Brains GmbH
Thomas Doerfler        Obere Lagerstrasse 30
D-82178 Puchheim       Germany
email: Thomas.Doerfler at embedded-brains.de
Phone: +49-89-18908079-2
Fax:   +49-89-18908079-9



More information about the users mailing list