Nesting Parentheses

This is a discussion on Nesting Parentheses within the C++ Programming forums, part of the General Programming Boards category; Just started and having phun. Can ne one tell me how deep is too deep when Nesting Parentheses in complex ...

  1. #1
    Registered User
    Join Date
    Jan 2003
    Posts
    2

    Nesting Parentheses

    Just started and having phun.
    Can ne one tell me how deep is too deep when Nesting Parentheses in complex expressions for MS Visual C++ - 6

    One thing this tut dusnt touch on.


    prolly a matter for debate I wld imagine

  2. #2
    It's full of stars adrianxw's Avatar
    Join Date
    Aug 2001
    Posts
    4,831
    If there is one, I'm not aware of it and certainly have never hit it. If you are nesting things very deeply, you probably have a design issue.

    Keep it simple.
    Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.

  3. #3
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    The maximum depth of {} is 247.

    I'd imagine a similar number for ( ), why don't you try it?
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  4. #4
    CIS and business major
    Join Date
    Aug 2002
    Posts
    194
    try to aviod nesting too many parenthesis, because it'll make your program difficult to read.
    Last edited by Terrance; 01-17-2003 at 06:41 PM.

  5. #5
    S Sang-drax's Avatar
    Join Date
    May 2002
    Location
    Göteborg, Sweden
    Posts
    2,072
    The only situation I can think of where knowing that limit might be useful, would be if you're automatically generating source code for some purpose.
    Last edited by Sang-drax : Tomorrow at 02:21 AM. Reason: Time travelling

  6. #6
    booyakasha
    Join Date
    Nov 2002
    Posts
    208
    I would personally do a redesign of anything nested more then three deep, and I think it's better to basically never nest anything unless doing things otherwise would become overly complex.
    I think it is good to stress program simplicity, modularity and readability over perceived efficiency.

  7. #7
    Registered User
    Join Date
    Jan 2003
    Posts
    2
    Thanks Peeps,

    I good to get a few opinions, I think ovverall for the sake of simplicity and beacuse I will want to reuse the code in future, three deep is a good rule of thumb.

    Thanks for your input

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Parentheses checker with stacks
    By cannsyl in forum C++ Programming
    Replies: 11
    Last Post: 12-05-2008, 01:17 PM
  2. Replies: 9
    Last Post: 10-20-2007, 01:05 AM
  3. Parentheses in IF statements.
    By thetinman in forum C++ Programming
    Replies: 11
    Last Post: 11-30-2005, 03:08 PM
  4. Nesting
    By coo_pal in forum C Programming
    Replies: 1
    Last Post: 01-27-2003, 10:16 PM
  5. #include nesting level?
    By Josho in forum C++ Programming
    Replies: 2
    Last Post: 09-23-2001, 12:28 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21