memxor.h:29:30: error: expected â;â, â,â or â)â before âdestâ

dear all,

I have the error above :
memxor.h:29:30: error: expected â;â, â,â or â)â before âdestâ
while compiling the code below in gcc:
#ifndef MEMXOR_H
# define MEMXOR_H

#include "stddef.h"

/* Compute binary exclusive OR of memory areas DEST and SRC, putting
the result in DEST, of length N bytes. Returns a pointer to
DEST. */
void *memxor (void *restrict dest, const void *restrict src, size_t n);

#endif /* MEMXOR_H */

(actually this is not the complete code, its a header of main code)
Is there any one have suggestion?
Thanks,
Identifiers cannot have spaces. "restrict dest" is not a valid identifier, nor is "restrict src".

EDIT: I am not familiar with C - as Luke points out below, this is a C language feature since C99. Try std=c99 or -std=c11, and make sure you are compiling as C and not C++.
Last edited on
closed account (3hM2Nwbp)
'restrict' is a keyword introduced in C99* ( http://en.wikipedia.org/wiki/Restrict )

I had thought so, but had to look it up myself to confirm.

Upon further research, the use of 'restrict' is an error in standard C++, although most compilers provide such a construct as an extension, none of which use the C keyword itself.

@OP - try compiling your program as C instead of C++, perhaps?
Last edited on
Topic archived. No new replies allowed.