Namespaces
Variants
Views
Actions

Talk:c/language/restrict

From cppreference.com

[edit] int restricted *p

isn't it allowed? as int is object type (no?). Second paragraph says no, but example shows yes.70.67.236.162 22:37, 15 March 2019 (PDT)

it is not allowed. I don't see an example that shows one. --Cubbi (talk) 15:57, 16 March 2019 (PDT)

[edit] deleted sentence

What is the thinking behind deleting the sentence "If a function type is declared with the restrict type qualifier (through the use of typedef), the behavior is undefined."? A version of this sentence appears in the pages "const type qualifier" and "volatile type qualifier", and all three versions derive from n1570:6.7.3(9). Also, does the reasoning warrant deleting the sentence from the const and volatile pages? I am seeking consistency among these three pages Newatthis (talk) 11:31, 7 December 2014 (PST)

making a function restrict is ill-formed rather than undefined, although I'll double-check next time I'm near a computer. --Cubbi (talk) 18:19, 7 December 2014 (PST)
A scan of n1570 yields no occurrence of the term "ill-formed," but I see it in stackoverflow.com So, I'll be interested in learning how you apply the term to decide what to include/exclude in cppreference. Newatthis (talk) 07:32, 8 December 2014 (PST)
if you want to be formal, restrict-qualifying a function type is a violation of the "shall not"-constraint from 6.7.3/2. It is already included on this cppreference page. --Cubbi (talk) 07:44, 8 December 2014 (PST)
Many thanks. Your response tells me what to study next. Newatthis (talk) 08:56, 8 December 2014 (PST)

[edit] struct members

Two questions about this sentence: "Even if the struct is declared at file scope, the aliasing assertions have block or function scope, depending on how the object of this struct time was created." (1) Is the word "time" a typo? (2) n1570:6.2.1(3) states, "A label name is the only kind of identifier that has function scope." Still on a learning curve with the standard, I may be missing something here. Newatthis (talk) 12:46, 12 December 2014 (PST)

yes a typo and yes I was imprecise: I meant the scope of a function parameter, which is a kind of block scope. --Cubbi (talk) 13:49, 12 December 2014 (PST)