9

I recently met a quiz question and I am not sure what it means. The question is as follows (no context):

We only need to save the stack pointer for a non-leaf procedure.

Just for reference, the "non-leaf procedure" means procedures that call other procedures.

Does it mean:

  1. The only thing we need to save in a non-leaf procedure is the stack pointer.
  2. The stack pointer needs to be saved only when it's in a non-leaf procedure.

Although common sense tells me 2 is more likely to be the intention of the question setter, I am not sure what this sentence really mean in terms of English syntax. I am not a native English speaker.

1
  • 1
    Note that you have quoted a statement and not a question. Also, why did you change the original for into in? I don't think that is necessary or justified.
    – Unreason
    Commented Aug 3, 2011 at 12:04

4 Answers 4

7

The second interpretation is the correct one.

The stack pointer needs to be saved for non-leaf procedures; for procedures that don't call other procedures, the stack pointer doesn't need to be saved.

9
  • 1
    That would mean that the second interpretation is correct, right?
    – Tragicomic
    Commented Jan 27, 2011 at 7:56
  • 2
    That's what he said for option 2. Commented Jan 27, 2011 at 7:59
  • 1
    That's right. I guess that when it's in a non-leaf procedure confused me.
    – avpaderno
    Commented Jan 27, 2011 at 8:02
  • 1
    However, is it possible to have another interpretation? Or in English there is only one interpretation.
    – LLS
    Commented Jan 27, 2011 at 14:53
  • 1
    To get interpretation 1, it should have been written "We need to save only the stack pointer for a non-leaf procedure." Commented Sep 5, 2011 at 0:07
4

Reading this as plain English, without the benefit of years spent as a software engineer, it is an ambiguous sentence and could be interpreted as perfectly sensible either way. So you need to know the context in which the sentence was written (or have some knowledge of the domain) and so could hardly blame anyone without some basic knowledge of low-level programming for wondering.

Your interpretation #2 is the correct one and arguably a much better way to write the sentence to avoid ambiguity.

0

I would doubt it... from my interpretation 1. is likely the correct one, that a non-leaf procedure only requires saving the stack pointer. btw I'm not a native english language speaker, but English spoken here (India) is in conformance to the textbooks.

1
  • 3
    We only need to save the stack pointer IN a non-leaf procedure - if it were this, I might agree with you. I think (2) is the intended meaning.
    – CJM
    Commented Jan 27, 2011 at 9:46
0

We are out of context, but it also might mean that it is something "simple" (We don't have to worry about any other situations)

Another example: if you don't want to get late, simply set the alarm clock / if you don't want to get late, you only have to set the alarm clock.

(also: no native english speaker here!)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .