6 Replies - 418 Views - Last Post: 02 June 2010 - 11:02 AM Rate Topic: -----

#1 gtech_singh  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 02-June 10

expected a ")"

Posted 02 June 2010 - 08:34 AM

while compiling my code i get error "reals.h(23): error: expected a ")""

code is



-------------------------------------------------------------
/**
 *  \file reals.h
 *
 *  \brief Implements some utility routines related to allocating
 *  vectors of real numbers.
 */

#if !defined (INC_REALS_H)
#define INC_REALS_H /*!< reals.h included. */

typedef float real_t;


#include <stddef.h>

/** Returns a newly allocated array of 'n' real numbers. */
real_t* reals_alloc (size_t n);

/** Initializes 'n' array elements to zero. */
void reals_zero (size_t n, real_t* x);

/** Copies elements from one real array to another. */
void reals_copy (size_t n, const real_t* restrict src, real_t* restrict dest);     // this is the line in which i get error      

/** Frees a previously allocated array of real numbers. */
void reals_free (real_t* x);

#endif /* !defined (INC_REALS_H) */

/* eof */

________________________________________________________

This post has been edited by JackOfAllTrades: 02 June 2010 - 08:41 AM
Reason for edit:: Added code tags.


Is This A Good Question/Topic? 0
  • +

Replies To: expected a ")"

#2 sarmanu  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 965
  • View blog
  • Posts: 2,362
  • Joined: 04-December 09

Re: expected a ")"

Posted 02 June 2010 - 08:36 AM

Variable names must not contain spaces.

This post has been edited by sarmanu: 02 June 2010 - 08:37 AM

Was This Post Helpful? 0
  • +
  • -

#3 gtech_singh  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 02-June 10

Re: expected a ")"

Posted 02 June 2010 - 08:41 AM

oid reals_copy (size_t n, const real_t* restrict src, real_t* restrict dest);

variable names are not having spaces

restrict is jus another keyword

http://www.devx.com/tips/Tip/13825
Was This Post Helpful? 0
  • +
  • -

#4 JackOfAllTrades  Icon User is online

  • Saucy!
  • member icon

Reputation: 5662
  • View blog
  • Posts: 22,505
  • Joined: 23-August 08

Re: expected a ")"

Posted 02 June 2010 - 08:43 AM

The restrict keyword is part of ISO C99. If your compiler doesn't support it, you may get this error.
Was This Post Helpful? 0
  • +
  • -

#5 RedSon  Icon User is offline

  • D.I.C Head

Reputation: 56
  • View blog
  • Posts: 179
  • Joined: 01-June 10

Re: expected a ")"

Posted 02 June 2010 - 08:45 AM

Are you using a Microsoft compiler?

The keyword is __restrict not restrict. I think GCC supports __restrict__ if you are using that.

Otherwise you can try removing the restrict decoration and see if that solves it.
[EDIT]

View PostJackOfAllTrades, on 02 June 2010 - 06:43 AM, said:

The restrict keyword is part of ISO C99. If your compiler doesn't support it, you may get this error.

Ninja'd

I need to learn to type faster...

This post has been edited by RedSon: 02 June 2010 - 08:46 AM

Was This Post Helpful? 2
  • +
  • -

#6 Salem_c  Icon User is offline

  • void main'ers are DOOMED
  • member icon

Reputation: 1418
  • View blog
  • Posts: 2,681
  • Joined: 30-May 10

Re: expected a ")"

Posted 02 June 2010 - 09:41 AM

If you are using an older (pre C99) compiler, then perhaps add this line to remove the extra keyword

#define restrict /* nothing */
Was This Post Helpful? 2
  • +
  • -

#7 gtech_singh  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 02-June 10

Re: expected a ")"

Posted 02 June 2010 - 11:02 AM

thanxx a lot everyone....

__restrict works.......
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1