[Developers] how to use CCTK_RESTRICT

Thomas Radke tradke at aei.mpg.de
Fri Oct 7 11:11:13 CDT 2005


Erik Schnetter wrote:
> That is at least what Cactus currently does.  For C code, it #defines  
> restrict to do the right thing, i.e., it is either undefined (so that  
> "restrict" stays "restrict"), or defined to __restrict__ or some  other 
> compiler-internal value, or defined to be empty if the compiler  does 
> not support it at all.  Of course, CCTK_RESTRICT works also for  C, but 
> it is much less readable.
> 
> It is not standard for C++, and Cactus doesn't do anything with  
> "restrict" in C++.  You must either use CCTK_RESTRICT, or you can  
> #define "restrict" in your code, depending on CCTK_RESTRICT, if you  
> prefer that.
> 
> In header files that may be included by both C or C++, you also have  to 
> use CCTK_RESTRICT.

I find this confusing. Can't we just agree on using "CCTK_RESTRICT" for 
both C and C++ ? I know, it's less readable (or, let's say, not as nice 
as writing "restrict") but at least it's consistent and I don't have to 
care about whether "restrict" is supported in C++ or not.


-- 
Cheers, Thomas.



More information about the Developers mailing list