Thread: restrict and arrays

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    but before it's an address, it's an array object, correct? only then would it undergo array to pointer conversion.

    let me put it another way...

    struct S { int i; char c; };
    S s = { 0 }, * restrict sp = &s; sp->i = 1;

    would s; invoke undefined behavior? sure, it wouldn't need the values of any of its members in that statement, but what about this statement?

    S s2 = s;

    surely that would be an access of s, and violating sp's restrict qualifier, right? if "S s2 = s;" invokes undefined behavior, why wouldn't "s;"? why wouldn't 'a;' invoke undefined behavior if "s;" invokes undefined behavior?
    Last edited by robwhit; 06-02-2010 at 10:20 PM. Reason: ;

Popular pages Recent additions subscribe to a feed