Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Address of register variable requested

I am trying to simplify the following fragment of code:

void foo() {
    register int r0, r1, r2, r3;
    r0 = 0;
    r1 = 0;
    r2 = 0;
    r3 = 0;
}

by introducing constant-size array and a loop over it

void foo() {
    register int r[4];
    for (int i = 0; i < 4; i++) {
        r[i] = 0;
    }
}

What I noticed is that it is not supported by some versions of compilers. Why?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

If the array object has register storage class, the
behavior is undefined.
.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading