ja******@gmail.com wrote:
if i write
A = 512 * 512 ;
for an 8-bit processor,compailer
who will compute the value? pre-processor or the compailer generate
assembly code for 8-bit processor to find the value,
can any body help me... by explaining this, how des this work
thanks
James
The fact you're using an 8-bit processor is much less (if at all)
important than the type of `A`. If `A` is not wide enough for the
result of the expression on the right, a compiler should issue a
warning (but is not required to). Decent compilers will allow you to
use more than 8-bit variables even on 8-bit architectures.
As for how and when the expression is calculated, that depends on the
compiler, and also on the options you pass to it. One thing is certain,
though: this is /not/ done by pre-processor.
Any half-decent compiler should calculate th value of the expression
during compilation, and generate only the store instruction (NB, it
will also do any operations that may be required to force the value
into `A`).
It may be possible to force the compiler to actually generate the code
for multiplication, but why would one want to do that?