Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Re: physical constants header file

Reply
Thread Tools

Re: physical constants header file

 
 
JKop
Guest
Posts: n/a
 
      10-19-2004

> 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



 
Reply With Quote
 
 
 
 
Ron Natalie
Guest
Posts: n/a
 
      10-19-2004
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.
 
Reply With Quote
 
 
 
 
JKop
Guest
Posts: n/a
 
      10-19-2004
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: physical constants header file Howard C++ 18 10-29-2004 09:59 AM
Re: physical constants header file rossum C++ 2 10-19-2004 08:57 PM
Re: physical constants header file Gene Nygaard C++ 0 10-19-2004 02:15 PM
Re: physical constants header file Richard Herring C++ 0 10-19-2004 12:22 PM
Re: physical constants header file rossum C++ 1 10-18-2004 10:08 PM



Advertisments