Computer Science Canada

l-values?

Author:  apomb [ Thu Mar 03, 2005 1:00 pm ]
Post subject:  l-values?

i keep getting the error "left operand must be l-value"
in VC++ 6 ... please help

Author:  wtd [ Thu Mar 03, 2005 1:23 pm ]
Post subject:  Re: l-values?

When you assign to something, that something has to be something you can assign to. Such things are often called l-values. Show me your code.

Author:  apomb [ Thu Mar 03, 2005 6:56 pm ]
Post subject: 

I'm at home right now, when i go back to school, ill post it, untill then, can you explain your explination again? ... all i got out of it was "show me your code" Laughing

Author:  wtd [ Thu Mar 03, 2005 9:16 pm ]
Post subject: 

say you have

code:
int foo;


"foo" is an l-value you can assign to.

code:
foo = 42;


But, if you have a function which returns an int, well you can't assign to that.

code:
int bar() { return 42; }


code:
bar() = 57;


The last doesn't work.

Author:  apomb [ Fri Mar 04, 2005 6:16 pm ]
Post subject: 

hmm, seems thats the thing ... ill try to rearrange the initialization of my varibles.

Author:  wtd [ Fri Mar 04, 2005 6:18 pm ]
Post subject: 

If you show me the code I can probably help you better, since I don't know which mistake you're making. Smile


: