Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
 All Forums
 Visual Assist
 Technical Support
 Dangling { in disabled code

You must be registered to post a reply.
Click here to register.

Screensize:
UserName:
Password:
Format: BoldItalicizeUnderlineStrikethrough Align leftCenterAlign right Insert horizontal ruleUpload and insert imageInsert hyperlinkInsert email addressInsert codeInsert quoted textInsert listInsert Emoji
   
Message:

Forum code is on.
Html is off.

 
Check to subscribe to this topic.
   

T O P I C    R E V I E W
mwb1100 Posted - May 21 2009 : 1:43:21 PM
I'm running a somewhat old version of VAX - 1649, so forgive me if this has already been addressed (I didn't notice anything mentioned in the release notes).

If a section of code that's disabled due to an #if or #ifdef ends with what would be an unbalanced brace if the code were enabled, VAX's Context box gets confused and all the functions that follow get lumped in as members of the function that has the sorta unbalanced brace:


void foo()
{
#if 0
    if (true) {
        return;
    }
    else {      // this dangling { in a disabled #if section
                //  confuses VAX's Context dropdown control
#endif
    return;
}

void bar()
{
    return;
}

int main() 
{  
    foo();
    bar();

    return 0;
}


Only foo() shows up in the global scope, while bar() and main() show up only inside of foo()'s scope as foo.bar or foo.main. Also in the editor window, bar and main get colored as variables.

I know that one of VAX's features/behaviors is parsing disabled sections (partly becuase uncertainty of whether or not a section will be disabled at compile time), but I'd like to know if this is something that I can control at least to some extent (other than getting rid of the unbalanced brace). This behavior has been bugging me for the past couple of days on a particular file, and it took more troubleshooting than I would have liked to track down.

The IDE has information on whether or not #if sections will be compiled, as it displays disabled sections differently - can VAX somehow use that information? Or can we at least get it to ignore sections that are clearly disabled - like "#if 0" sections?
1   L A T E S T    R E P L I E S    (Newest First)
accord Posted - May 21 2009 : 5:57:08 PM
VA parses all #ifdef blocks, so you can navigate and use completion listboxes even in disabled configurations. So this is by design.

But #ifdef 0 is somewhat different, since it is never compiled, but it can confuse the parser, like in your case so I've put in an enhancement request to see what the developers make of it:

case=27255

© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000