views:

236

answers:

2

I got the question in the interview.

I had a difficulty in answering it. I was not sure where I should start. Finally, I discussed how the question is related to compilers and to their construction.

I was not sure what "compilers' integers" mean exactly. It seems to me now that the word compiler was to confuse candidates.

How would you answer to the question in 5 minutes?

A: 

The question is probably trying to get you to talk about registers. Information is copied into registers, and then the machine code operators are applied to them, and then the information is copied back out of the registers.

Jason Coyne
On x86 most instructions accept a memory address as one operand. e.g. ADD [some_var], eax.
Bastien Léonard
+3  A: 

Five-minute version of my hardware architecture class:

Integers, as any other form of data, are copied from disk through the memory hierarchy up to the CPU registers where it can used as arguments to assembly instructions.

The result of assembly instructions eventually make their way back down the memory hierarchy to the RAM where they can be accessed by memory pointers.

The compiler is in charge of creating the assembly language which will efficiently manage the limited registers of the CPU.

In higher-level computer languages the assembly which manages these registers is usually completely transparent and abstracted using variables.

Ben S
Thank you for the answer!
Masi