[ET Trac] [Einstein Toolkit] #1975: Cactus: mark routines used by DECLARE_CCTK_ARGUMENTS as pure

Einstein Toolkit trac-noreply at einsteintoolkit.org
Fri Nov 4 17:41:25 CDT 2016


#1975: Cactus: mark routines used by DECLARE_CCTK_ARGUMENTS as pure
--------------------------+-------------------------------------------------
  Reporter:  rhaas        |       Owner:                     
      Type:  enhancement  |      Status:  review             
  Priority:  minor        |   Milestone:                     
 Component:  Cactus       |     Version:  development version
Resolution:               |    Keywords:                     
--------------------------+-------------------------------------------------
Changes (by rhaas):

  * status:  new => review


Comment:

 As far as I know, dependence on global variables is allowed for pure
 functions (from the linked gcc docs):
 {{{
 pure
     Many functions have no effects except the return value and their
 return value depends only on the parameters and/or global variables.
 }}}
 and eg strlen is given as an example.

 They are not "const" since their result depends on more than just the
 *values* of their arguments (they inspect the content of the pointers and
 the gcc state that for const "Basically this is just slightly more strict
 class than the pure attribute below, since function is not allowed to read
 global memory.").

 I think one has to be very careful with what is const and what is pure.
 Code generation errors may be a different matter.

-- 
Ticket URL: <https://trac.einsteintoolkit.org/ticket/1975#comment:2>
Einstein Toolkit <http://einsteintoolkit.org>
The Einstein Toolkit


More information about the Trac mailing list