Thread: Reference are always lvalue?

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    1,579

    Reference are always lvalue?

    Hello everyone,


    Is the conclusion correct? Both const reference and non-const reference are lvalue?

    I think it is true and I can not find a sample which does not follow it.


    thanks in advance,
    George

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    For all intents and purposes, yes. (From a language lawyer standpoint, I think references are actually neither, but can always be converted to lvalues.)
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  3. #3
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Thanks CornedBee,


    Could you provide more description please what do you mean below?

    *I think references are actually neither, but can always be converted to lvalues*?

    Quote Originally Posted by CornedBee View Post
    For all intents and purposes, yes. (From a language lawyer standpoint, I think references are actually neither, but can always be converted to lvalues.)

    regards,
    George

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    No, I can't. I'm too lazy to look up the wording of the standard, and it doesn't matter.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Registered User
    Join Date
    May 2006
    Posts
    1,579
    Well CornedBee, it is ok. I assume all references -- non-const and const reference -- are both lvalues. :-)

    Quote Originally Posted by CornedBee View Post
    No, I can't. I'm too lazy to look up the wording of the standard, and it doesn't matter.

    regards,
    George

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting an error with OpenGL: collect2: ld returned 1 exit status
    By Lorgon Jortle in forum C++ Programming
    Replies: 6
    Last Post: 05-08-2009, 08:18 PM
  2. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  3. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  4. C OpenGL Compiler Error?
    By Matt3000 in forum C Programming
    Replies: 12
    Last Post: 07-07-2006, 04:42 PM
  5. c++ linking problem for x11
    By kron in forum Linux Programming
    Replies: 1
    Last Post: 11-19-2004, 10:18 AM