Re: #define for very small numbers ?
Richard Tobin wrote:
> In article <66gdk8F2kg6m6U9@mid.individual.net>,
> Ian Collins <ian-news@hotmail.com> wrote:
>
>>> A definite point. However, what use is a stored const? Accessing
>>> it requires loading an address and then dereferencing. A compile
>>> time constant just requires loading the value.
>
>> Which is what any self respecting optimiser will do with a constant.
>
> But C's const variables are not constants. Do the guarantees that
> const makes actually allow the compiler to assume the variable's
> value in a situation like this?
They may not be compile time constants, but they are "read only", so the
compiler is safe to assume their value will not change.
--
Ian Collins.
|