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. Advertising

  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. Advertising

  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. Advertising

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. rossum
    Replies:
    2
    Views:
    435
    rossum
    Oct 19, 2004
  2. rossum
    Replies:
    1
    Views:
    344
    rossum
    Oct 18, 2004
  3. Richard Herring

    Re: physical constants header file

    Richard Herring, Oct 19, 2004, in forum: C++
    Replies:
    0
    Views:
    389
    Richard Herring
    Oct 19, 2004
  4. Gene Nygaard

    Re: physical constants header file

    Gene Nygaard, Oct 19, 2004, in forum: C++
    Replies:
    0
    Views:
    588
    Gene Nygaard
    Oct 19, 2004
  5. Howard
    Replies:
    18
    Views:
    702
Loading...

Share This Page