Re: physical constants header file

Discussion in 'C++' started by JKop, Oct 19, 2004.

  1. JKop

    JKop Guest


    > const double dollar = 1.0;
    > const double dollars = dollar;



    Not that it makes a difference, but I'd use a reference there:


    double const dollar = 1.0

    double const &dollars = dollar;


    -JKop
     
    JKop, Oct 19, 2004
    #1
    1. Advertisements

  2. JKop

    Ron Natalie Guest

    JKop wrote:
    >> const double dollar = 1.0;
    >> const double dollars = dollar;

    >
    >
    >
    > Not that it makes a difference, but I'd use a reference there:
    >
    >
    > double const dollar = 1.0
    >
    > double const &dollars = dollar;


    It does make a difference, why would you use a reference?
    A reference causes it not to be a constant expression anymore.
     
    Ron Natalie, Oct 19, 2004
    #2
    1. Advertisements

  3. JKop

    JKop Guest

    Ron Natalie posted:

    > JKop wrote:
    >>> const double dollar = 1.0; const double
    >>> dollars = dollar;

    >>
    >>
    >>
    >> Not that it makes a difference, but I'd use a reference there:
    >>
    >>
    >> double const dollar = 1.0
    >>
    >> double const &dollars = dollar;

    >
    > It does make a difference, why would you use a reference?
    > A reference causes it not to be a constant expression anymore.
    >


    My bad, you're right.

    I was just thinking along the lines of reusing the original variable.


    -JKop
     
    JKop, Oct 19, 2004
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Newsgroup - Ann
    Replies:
    4
    Views:
    933
    lilburne
    Nov 2, 2003
  2. rossum
    Replies:
    2
    Views:
    492
    rossum
    Oct 19, 2004
  3. rossum
    Replies:
    1
    Views:
    410
    rossum
    Oct 18, 2004
  4. Howard
    Replies:
    18
    Views:
    805
  5. Replies:
    2
    Views:
    382
  6. Rares Vernica

    Re: Physical constants

    Rares Vernica, Nov 4, 2006, in forum: Python
    Replies:
    2
    Views:
    345
    Steven D'Aprano
    Nov 4, 2006
  7. Bit byte
    Replies:
    1
    Views:
    857
    benben
    Apr 19, 2006
  8. mlt
    Replies:
    2
    Views:
    1,153
    Jean-Marc Bourguet
    Jan 31, 2009
Loading...