Difference between cast used in Compound literals and that done on a pointer variable?
        Posted  
        
            by Sandip
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Sandip
        
        
        
        Published on 2010-03-09T05:47:50Z
        Indexed on 
            2010/03/09
            5:51 UTC
        
        
        Read the original article
        Hit count: 303
        
Filed under: 
        c
Consider the following code:
int main()
{ 
    int *p;
    ++((int){5});    //compile without err/warning
    &((int){5});     //compile without err/warning
    ++((char *)p);   //Compile-time err: invalid lvalue in increment
    &((char *)p);    //Compile-time err: invalid lvalue in unary '&'
}
Why do the Compound Literals do not generate errors here?
© Stack Overflow or respective owner