Questions about restricted pointers

S

Spiros Bousbouras

In 6.7.3.1 of n1124 we read:

If D appears inside a block and does
not have storage class extern, let B
denote the block. If D appears in the
list of parameter declarations of a
function definition, let B denote the
associated block. Otherwise, let B
denote the block of main (or the
block of whatever function is called
at program startup in a freestanding
environment).

I'm not sure I understand this. If we have in file
scope something like
restrict char *p ;
then what is B ? Is it the block of main() ?

A bit further down we read:

A translator is free to ignore any or all
aliasing implications of uses of restrict.

What might these aliasing implications be ? Can
anyone give me some examples ?
 
R

Richard Bos

Spiros Bousbouras said:
In 6.7.3.1 of n1124 we read:

If D appears inside a block and does
not have storage class extern, let B
denote the block. If D appears in the
list of parameter declarations of a
function definition, let B denote the
associated block. Otherwise, let B
denote the block of main (or the
block of whatever function is called
at program startup in a freestanding
environment).

I'm not sure I understand this. If we have in file
scope something like
restrict char *p ;
then what is B ? Is it the block of main() ?

Since file scope falls under "otherwise" (being neither inside a block
nor in a parameter declaration list), yes.

Richard
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,152
Latest member
LorettaGur
Top