Hello,
I have a question abour c99 restrict type-qualifer. I wrote a simple C program to check restrict qualifer :
I compiled this code with -std=c99.
In my understanding of restrict it should be impossible to access memory points by restart pointer throught sk pointer (am i right?), but it is possible in this little program.
On this web page http://www.freebsd.org/projects/c99/index.html i found information that restrict qualifer is still work in progress but some functions in freebsd 8.0 (for example sigaction) are using this qualifer.
So my two questions are:
- If i understand restrict type-qualifer correctly?
- Why FreeBSD use this qualifer if it is in "work in progress"?
Best regards
I have a question abour c99 restrict type-qualifer. I wrote a simple C program to check restrict qualifer :
Code:
#include <stdio.h>
#include <stdlib.h>
int main() {
int *restrict restar = (int *) malloc(sizeof(int) * 10);
int *sk = restar;
*(sk + 1) = 5;
printf("%d\n", *(sk + 1));
return 0;
}
I compiled this code with -std=c99.
In my understanding of restrict it should be impossible to access memory points by restart pointer throught sk pointer (am i right?), but it is possible in this little program.
On this web page http://www.freebsd.org/projects/c99/index.html i found information that restrict qualifer is still work in progress but some functions in freebsd 8.0 (for example sigaction) are using this qualifer.
So my two questions are:
- If i understand restrict type-qualifer correctly?
- Why FreeBSD use this qualifer if it is in "work in progress"?
Best regards