Author Topic: Matching brace and preprocessor  (Read 2612 times)

Offline vix

  • Multiple posting newcomer
  • *
  • Posts: 60
Matching brace and preprocessor
« on: July 17, 2009, 01:20:53 pm »
I don't know if this is a known behaviour; I searched into the forum but I didn't find any information about it, so I started a new thread.
The Matching Brace feature doesn't work in the right way when there are some preprocessor directives.
For example if you have the following code
Code
{
a++;
#if 0
if(a==1){
#else
if(b==2){
#endif
c = a+b;
}
c--;
}
the first '{' is highlighted as 'no matching brace', the one after "if(a==1)" is matched with the last one, and so on...

I know this could seem quite a strange piece of code, and in fact it is...
I know there is an easy workaround (i.e. moving all the '{' outside preprocessor directives),
but I only want to point out this unexpected behaviour.

Best regards

vix

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5916
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Matching brace and preprocessor
« Reply #1 on: July 17, 2009, 05:47:17 pm »
I think this is a problem in
http://www.scintilla.org/
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.