Re: invalid lvalue in assignment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Eljay,

here is some code:

************************************************************
compiler message:
=================

/usr/local/src/runkit-0.9/runkit_sandbox.c: In function 
'php_runkit_sandbox_active_getter':
/usr/local/src/runkit-0.9/runkit_sandbox.c:1557: error: invalid lvalue in 
assignment

/usr/local/src/runkit-0.9/runkit_sandbox.c: In function 
'php_runkit_sandbox_parent_access_getter':
/usr/local/src/runkit-0.9/runkit_sandbox.c:1558: error: invalid lvalue in 
assignment

source code excerpt 1:
======================

PHP_RUNKIT_SANDBOX_SETTING_BOOL_RD(active)
PHP_RUNKIT_SANDBOX_SETTING_BOOL_RW(parent_access)

(lines 1557/1558)

source code excerpt 2:
======================

#define PHP_RUNKIT_SANDBOX_SETTING_BOOL_WR(name) \
PHP_RUNKIT_SANDBOX_SETTING_SETTER(name) \
{ \
        zval copyval = *value; \
\
        zval_copy_ctor(&copyval); \
        convert_to_boolean(&copyval); \
        objval->name = Z_BVAL(copyval) ? 1 : 0; \
}
#define PHP_RUNKIT_SANDBOX_SETTING_BOOL_RD(name) \
PHP_RUNKIT_SANDBOX_SETTING_GETTER(name) \
{ \
        zval *retval; \
\
        ALLOC_ZVAL(retval); \
        Z_TYPE_P(retval) = IS_BOOL; \
        Z_BVAL_P(retval) = objval->name; \
        retval->refcount = 0; \
        retval->is_ref = 0; \
\
        return retval; \
}
#define PHP_RUNKIT_SANDBOX_SETTING_BOOL_RW(name) \
PHP_RUNKIT_SANDBOX_SETTING_BOOL_WR(name) \
PHP_RUNKIT_SANDBOX_SETTING_BOOL_RD(name)

output (excerpt) of 'gcc -E ...':
=================================

typedef unsigned char zend_bool;

...

static zval* php_runkit_sandbox_active_getter(php_runkit_sandbox_object 
*objval, void ***tsrm_ls) { 
   zval *retval; 
   (retval) = (zval *) _emalloc((sizeof(zval)) ,  
"/usr/local/src/runkit-0.9/runkit_sandbox.c", 1557 , ((void *)0), 0);
   (*retval).type = 3;
   ((zend_bool)(*retval).value.lval) = objval->active;
   retval->refcount = 0;
   retval->is_ref = 0;
   return retval; 
}
...
static zval* php_runkit_sandbox_parent_access_getter(php_runkit_sandbox_object 
*objval , void ***tsrm_ls) 
{ 
   zval *retval;
  (retval) = (zval *) _emalloc((sizeof(zval)) , 
"/usr/local/src/runkit-0.9/runkit_sandbox.c", 1558 , ((void *)0), 0)
;
  (*retval).type = 3;
  ((zend_bool)(*retval).value.lval) = objval->parent_access;
  retval->refcount = 0;
  retval->is_ref = 0;
  return retval; 
}

************************************************************

Thank you for having a look on it.

Regards,

Oliver


Am Dienstag, 20. Februar 2007 17:46 schrieben Sie:
> Hi Oliver,
>
> Here is an example of an invalid lvalue in assignment:
> : cat test.c
>
> int foo()
> {
>         return 7;
> }
>
> int main()
> {
>         foo() = 3; // Line 8
> }
>
> : gcc test.c
>
> test.c: In function 'main':
> test.c:8: error: invalid lvalue in assignment
>
> Notice that line 8 is trying to assign 3 to an rvalue.  An rvalue is not an
> lvalue.
>
> Also notice that GCC indicated the line, 8, that the invalid lvalue in
> assignment is being attempted.
>
> I can only give you a general example and guidelines as to how things are
> going awry in the error you've encountered.  If you can provide a small
> compilable example of the problem you are facing, I can give you better
> advice.
>
> HTH,
> --Eljay

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux