Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
2 votes
2 answers
106 views

I'm asking this question from the perspective of a compiler developer – I want to know whether a particular potential optimisation is valid (because all programs that the optimisation would break have ...
ais523's user avatar
  • 2,384
Advice
0 votes
3 replies
97 views

I'm in C and I have an int ** (2 dimensional array, it's basically a matrix, it's actually set up a little bit complicated but there's no internal aliasing, so it's not relevant). is this int** ...
Snark's user avatar
  • 1,674
2 votes
3 answers
194 views

size_t hash(char const[restrict static 32]) [[reproducible]]; This is a function definition from Modern C by Jens Gustedt. I understand that this is a more preferred alternate notation to a 32 char ...
Puscas Raul's user avatar
0 votes
0 answers
91 views

I am aware that __restrict__ is not standard C++ and is instead an extension of C99 that GCC supports (previous question of mine: Uncertainty of GCC __restrict__ rules) However, if we make some ...
asimes's user avatar
  • 6,202
3 votes
1 answer
146 views

I’m trying to understand the nuances of the restrict keyword in C, particularly how its behavior might differ when applied to a pointer to a structure versus a pointer to a primitive type like int. ...
Alphin Thomas's user avatar
3 votes
3 answers
137 views

My understanding of restrict qualified pointers in that no restrict qualified pointer may point to the same memory address as another pointer if both pointers are accessible within the same scope. (...
Badasahog's user avatar
  • 1,025
1 vote
2 answers
234 views

We use extern "C" { ... } to include C header files in C++. This does not seem to work if the C file uses C99 keywords such as restrict. For example: test.h #ifndef TEST_H #define TEST_H ...
Ryan Maguire's user avatar
5 votes
1 answer
202 views

Is the following valid usage of restrict qualifier in C or undefined behaviour? #include <stdio.h> int foo(float * restrict a) { float a1 = *a; float a2 = *(a+1); float * restrict ...
Aditya Kurrodu's user avatar
4 votes
1 answer
124 views

I was thinking about the utility of non-standard __restrict keyword in C and C++ and how its effect can be emulated by carefully declare (disjoint) value objects . Restrict is usually explained ...
alfC's user avatar
  • 16.8k
1 vote
1 answer
122 views

2011 6.7.3.1 says: 1 Let D be a declaration of an ordinary identifier that provides a means of designating an object P as a restrict-qualified pointer to type T. 2 If D appears inside a block and ...
user24723440's user avatar
0 votes
0 answers
74 views

I am writing some C++ code and compiling with g++. I use the __restrict__ keyword on pointer arrays in some performance critical places to hopefully get better performance. std::vector::operator[] has ...
ander's user avatar
  • 41
6 votes
1 answer
96 views

Is the C restrict keyword/qualifier transitive through multiple levels of pointer indirection? For instance, given the following snippet: struct Bar { int b; }; struct Foo { struct Bar* bar; }...
MicroVirus's user avatar
  • 5,507
1 vote
1 answer
108 views

In Modern C, Jens Gustedt states that: With the exclusion of character types, only pointers of the same base type may alias. But then I find this declaration of fgetpos() in Annex B of the C ...
Madagascar's user avatar
  • 7,440
3 votes
2 answers
252 views

Consider this code: extern int A[2]; /* Just returns `p` back. */ extern int *identity(int *p); int f(int *restrict p) { int *q = identity(p); /* `q` becomes "based on" `p` */ int ...
pan's user avatar
  • 183
1 vote
0 answers
66 views

If I have an aliasing T *restrict, but it is never used, is this considered undefined-behavior. Or is undefined behavior at the point of use. For example int *nothing = NULL; int *restrict ...
doliphin's user avatar
  • 1,044

15 30 50 per page
1
2 3 4 5
11