Thread: L-value use with the compiler.

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    22

    Question L-value use with the compiler.

    Hi,

    What are the l values and r values using in the C statement, How compiler is using these?

    Specially with the pointers.

    Is there any link which describe the concept of L-value and R-value related to C?



    Thanks
    Bhupesh

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,268
    You can probably do a google search to find an article which explains this in detail. In basic terms though, an L-Value is something that can appear on the left side of an equals sign, and R-Values are everything else. There are exceptions to this rule (const objects are L-Values), but it holds true for the most part.

    http://msdn2.microsoft.com/en-us/library/bkbs2cds.aspx

  3. #3
    Registered User
    Join Date
    Oct 2007
    Posts
    22

    Lightbulb

    Hi...thanx for the reply...

    i have gone through msdn link also, still didnt get properly.
    what are the rules for that?

    Regards
    Bhupesh

  4. #4
    Registered User
    Join Date
    Dec 2007
    Posts
    25
    Code:
    # define EVERYTHINK 0
    int main ( void )
    { 
       while ( C_learning )
                 english_learning ( );
       return EVERYTHINK;
    }

  5. #5
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    The basic rule is: anything that results in a "single variable" (so, not an array) that can be assigned a new value is an Lvalue.

    Lvalues is what end up on the left on an assignment, and when the compiler says "not an lvalue", it means, strictly, that it's "not something it can assign a new value to".

    I'm not sure if this explains it any better than the above links, but if it's still not clear, can you perhaps explain what exactly it is you don't understand.

    --
    Mats
    Compilers can produce warnings - make the compiler programmers happy: Use them!
    Please don't PM me for help - and no, I don't do help over instant messengers.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Compiler Paths...
    By Cobra in forum C++ Programming
    Replies: 5
    Last Post: 09-26-2006, 04:04 AM
  2. C Compiler and stuff
    By pal1ndr0me in forum C Programming
    Replies: 10
    Last Post: 07-21-2006, 11:07 AM
  3. I can't get this new compiler to work.
    By Loduwijk in forum C++ Programming
    Replies: 7
    Last Post: 03-29-2006, 06:42 AM
  4. how to call a compiler?
    By castlelight in forum C Programming
    Replies: 3
    Last Post: 11-22-2005, 11:28 AM
  5. Bad code or bad compiler?
    By musayume in forum C Programming
    Replies: 3
    Last Post: 10-22-2001, 09:08 PM