F
Flash Gordon
Podi wrote, On 30/11/07 07:22:
Oh, I'm familiar with that general type of layout and have been for a
long time. I'm also familiar with a number of other memory layouts,
including having program and data in completely separate address spaces
(i.e. address 0x1000 is *both* an address in program space *and* an
address in data space, and the contents is completely different and
unrelated in the two address spaces), systems where the stack runs the
other way, systems without a heap where it has been arranged so that the
stack grows away from other data etc.
Anyone with any real knowledge will take under 5 minutes to learn that
variation, so I would put familiarity with it a long way down the list.
No, the correct best answer is to start off with what the C standard
gives and the fact that it is implementation dependant and then (if
required) go on to a few examples of typical arrangements including (and
starting with), if you know the expected target, the memory layout on
the expected target.
Depends who asked the question what the expected answer is. In any case,
if you are the interviewer and you want to know if someone knows about
memory layouts then ask *that* question rather than a different
question. Otherwise you will risk rejecting programmers for answering
the question you asked when they know the answer to the question you
should have asked as well.
No one has suggested claiming ignorance of stacks and heaps in an
interview. My main point is that to test the knowledge you want to test
you should be asking a different question.
I agree, and thanks for all the corrections on my posts with my
limited knowledge on the C standard.
Since we deal with mostly Windows (desktop + many variants of CE) and
Linux (many variants of desktop + many variants of embedded Linux),
and our code happens to be in C and C++, we are looking for people who
are at least familiar with the concept of memory layout as described
in the following.
http://dirac.org/linux/gdb/02a-Memory_Layout_And_The_Stack.php
Oh, I'm familiar with that general type of layout and have been for a
long time. I'm also familiar with a number of other memory layouts,
including having program and data in completely separate address spaces
(i.e. address 0x1000 is *both* an address in program space *and* an
address in data space, and the contents is completely different and
unrelated in the two address spaces), systems where the stack runs the
other way, systems without a heap where it has been arranged so that the
stack grows away from other data etc.
Anyone with any real knowledge will take under 5 minutes to learn that
variation, so I would put familiarity with it a long way down the list.
Since we also deal with many compilers, some of which do not comply
with "the standard", we are (at least I am) slacking quite a bit on
the correct definition of C
At the end of the day, the answer "implementation-specific" to OP is
wise and correct, but it will unlikely satisfy the interviewer. The
No, the correct best answer is to start off with what the C standard
gives and the fact that it is implementation dependant and then (if
required) go on to a few examples of typical arrangements including (and
starting with), if you know the expected target, the memory layout on
the expected target.
expected answer is to describe the "general" memory layout of a
process, given the simple, yet subtle question asked in C.
Depends who asked the question what the expected answer is. In any case,
if you are the interviewer and you want to know if someone knows about
memory layouts then ask *that* question rather than a different
question. Otherwise you will risk rejecting programmers for answering
the question you asked when they know the answer to the question you
should have asked as well.
And never
heard of "stack/heap" is sort of a no-no
No one has suggested claiming ignorance of stacks and heaps in an
interview. My main point is that to test the knowledge you want to test
you should be asking a different question.