This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH][libcpp] New deferred output pragma


On 04/13/2010 07:31 PM, Rahul Kharche wrote:
int
bar (int *array, int offset, int size)
{
   int access (int *array, int index) __attribute__ ((far));

This prototype is referring to a global function. The error is confusing indeed, but correct. Both of these however (seem to) work:


int
bar1 (int *array, int offset, int size)
{
  auto int access (int *array, int index) __attribute__ ((pure));
  auto int access (int *array, int index)
  {
    return array[index + offset];
  }

  int i;
  for (i = 0; i < size; i++)
    access (array, i);
}

int
bar2 (int *array, int offset, int size)
{
  int __attribute__ ((pure)) access (int *array, int index)
  {
    return array[index + offset];
  }

  int i;
  for (i = 0; i < size; i++)
    access (array, i);
}

Paolo


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]