How many levels of nesting must be supported by a computer ?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TILLI
    New Member
    • Jan 2010
    • 2

    #1

    How many levels of nesting must be supported by a computer ?

    (according to ANSI specifications)
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    How many levels of nesting what?

    Comment

    • TILLI
      New Member
      • Jan 2010
      • 2

      #3
      Don't know. This was the only question. Perhaps of nested if .Is there any minimum number?
      Anyways the options are: 10, 15, 25, 30, none of these.

      Comment

      • RedSon
        Recognized Expert Expert
        • Jan 2007
        • 4980

        #4
        It's impossible to answer that question. There is no subject in that sentence. It's like asking the question: "How many cups are in a recipe according to Better Homes and Gardens?"

        How many cups of what are in what recipe? It's unanswerable.

        Comment

        • donbock
          Recognized Expert Top Contributor
          • Mar 2008
          • 2427

          #5
          Refer to C99 section 5.2.4.1 (Environmental Limits: Translation limits). This tells us that a conforming implementation must be able to translate and execute a program containing at least one instance of the following nesting-level related limits:
          • 127 nesting levels of blocks
          • 63 nesting levels of conditional inclusion
          • 63 nesting levels of parenthesized declarators within a full declarator
          • 63 nesting levels of parenthesized expressions within a full expression
          • 15 nesting levels for #included files
          • 63 levels of nested structure or union definitions in a single struct-declaration-list
          • (Perhaps other limits that I didn't see when I skimmed C99 for this post.)

          So it is clear that Banfa and RedSon are right -- the answer depends on just what it is that you're trying to nest.

          Comment

          Working...