Board index » cppbuilder » Strange behaviour of BDS2006 when inserting 'matching' '}' automatically or How to find superflous '{'?

Strange behaviour of BDS2006 when inserting 'matching' '}' automatically or How to find superflous '{'?


2006-09-29 06:28:00 PM
cppbuilder40
Sometimes when a program compiles fine, BDS adds a '}' automatically
when pressing RETURN to insert a new line.
So it seems, it thinks there is an unclosed '{', but this is not
correct (else the compilation would have failed).
Even the key-sequence to find a matching bracket (e.g. CTRL-Q [) does
not find anything.
I tried to find the position in my program which irritates BDS2006 (by
succidently removing function by function from the bottom) and check,
if BDS inserts a '}' yet, when pressing RETURN.
I finally found out, that if I remove a comment in a single line quite
in the middle of a module in my program
menu_item->Tag=(int)&*_it; // Tag contains the address of the
list-entry, so to find out, if the list-entry is still valid, we have
to find out, if '*(AnsiString *)menu_item->Tag' points to an element
of the list
->
menu_item->Tag=(int)&*_it;
this effect does not occur any more.
It does not occur either if I use /* */ instead of //.
I even tried to insert this single line in a new function in a new
module
void fct(void) {
menu_item->Tag=(int)&*_it; // Tag contains the address of the
list-entry, so to find out, if the list-entry is still valid, we have
to find out, if '*(AnsiString *)menu_item->Tag' points to an element
of the list
}
but there this effect does not occur. (So unfortunately I do not have
a simple example, everyone could try it out for himself).
Does anyone know where this comes from or even better how to remove
these disturbing insertions of '}' whithout removing this feature at
all?
Thanks,
Michael
 
 

Re:Strange behaviour of BDS2006 when inserting 'matching' '}' automatically or How to find superflous '{'?

On Fri, 29 Sep 2006 12:28:00 +0200, <MR>wrote:
Quote
Does anyone know where this comes from or even better how to remove
looks like another manifestation of bug in parser which drives
code-folding crazy, see recent thread
Quote
these disturbing insertions of '}' whithout removing this feature at
unfortunately you either need to "clean" your sources in order for
parser to be happy or turn that feature off (as I had to) and wait
till the next release when borland hopefully will fix those issues
--
Vladimir Ulchenko aka vavan
 

Re:Strange behaviour of BDS2006 when inserting 'matching' '}' automatically or How to find superflous '{'?

On Fri, 29 Sep 2006 12:28:00 +0200, <MR>wrote:
Quote
Sometimes when a program compiles fine, BDS adds a '}' automatically
when pressing RETURN to insert a new line.
<...>

I finally found out, that if I remove a comment in a single line quite
in the middle of a module in my program

menu_item->Tag=(int)&*_it; // Tag contains the address of the
list-entry, so to find out, if the list-entry is still valid, we have
to find out, if '*(AnsiString *)menu_item->Tag' points to an element
of the list

<...>
Does anyone know where this comes from or even better how to remove
these disturbing insertions of '}' whithout removing this feature at
all?

Well, I don't really know, but I suspect that the comment is too long
for some internal buffer, and thus the line is splitted in two, in the
precise point to behave in such a moronic manner.
Anycase, it is always good programming style to keep lines limited to
some 70-80 columns, so that they will not wrap neither on screen nor
on printing. Your comment is really looooong. And boring. So it will
be ignored by anyone but you. And probably by you too, in two or three
weeks time.
Zara
 

{smallsort}

Re:Strange behaviour of BDS2006 when inserting 'matching' '}' automatically or How to find superflous '{'?

I would suggest that you add a simple case where this
happens to QC and then borland will have another test case
to check. They are fixing quite a few of these types of bugs
at present. It may not make it into a hotfix unfortunately.
qc.borland.com
Rgds Pete
<MR>wrote in message
Quote
Sometimes when a program compiles fine, BDS adds a '}'
automatically
when pressing RETURN to insert a new line.

So it seems, it thinks there is an unclosed '{', but this
is not
correct (else the compilation would have failed).

Even the key-sequence to find a matching bracket (e.g.
CTRL-Q [) does
not find anything.

I tried to find the position in my program which irritates
BDS2006 (by
succidently removing function by function from the bottom)
and check,
if BDS inserts a '}' yet, when pressing RETURN.

I finally found out, that if I remove a comment in a
single line quite
in the middle of a module in my program

menu_item->Tag=(int)&*_it; // Tag contains the address of
the
list-entry, so to find out, if the list-entry is still
valid, we have
to find out, if '*(AnsiString *)menu_item->Tag' points to
an element
of the list

->

menu_item->Tag=(int)&*_it;

this effect does not occur any more.

It does not occur either if I use /* */ instead of //.


I even tried to insert this single line in a new function
in a new
module

void fct(void) {
menu_item->Tag=(int)&*_it; // Tag contains the address of
the
list-entry, so to find out, if the list-entry is still
valid, we have
to find out, if '*(AnsiString *)menu_item->Tag' points to
an element
of the list
}

but there this effect does not occur. (So unfortunately I
do not have
a simple example, everyone could try it out for himself).


Does anyone know where this comes from or even better how
to remove
these disturbing insertions of '}' whithout removing this
feature at
all?

Thanks,

Michael
 

Re:Strange behaviour of BDS2006 when inserting 'matching' '}' automatically or How to find superflous '{'?

"Pete Fraser" < XXXX@XXXXX.COM >
schrieb:
Quote
I would suggest that you add a simple case where this
happens to QC and then borland will have another test case
to check. They are fixing quite a few of these types of bugs
at present. It may not make it into a hotfix unfortunately.
qc.borland.com
Rgds Pete
Easier said than done. When removing all other lines of this function
(or just this single line) this misbehaviour does not occur. Also it
is done, if I cut my comment.
Because this problem occurs in differnt situations it is hard to
believe, that it does not occur at Borland at all.
But if I find a simple - only some line long - example where this
occurs I'll publish it in QC.
Michael
 

Re:Strange behaviour of BDS2006 when inserting 'matching' '}' automatically or How to find superflous '{'?

MR,
As Pete states a simple example is preferred. If you can not get it to
reproduce with a small test case that is fine too. *Something* is always
better than nothing. I don't mind if the file is 20k lines of code as long
as I can get an example of the failure. Also, if you don't want to post the
file publically then please feel free to email it to me so that I can take a
look at it.
Thanks,
-Adam
<MR>wrote in message news: XXXX@XXXXX.COM ...
Quote
"Pete Fraser" < XXXX@XXXXX.COM >
schrieb:

>I would suggest that you add a simple case where this
>happens to QC and then borland will have another test case
>to check. They are fixing quite a few of these types of bugs
>at present. It may not make it into a hotfix unfortunately.
>qc.borland.com
>Rgds Pete

Easier said than done. When removing all other lines of this function
(or just this single line) this misbehaviour does not occur. Also it
is done, if I cut my comment.

Because this problem occurs in differnt situations it is hard to
believe, that it does not occur at Borland at all.

But if I find a simple - only some line long - example where this
occurs I'll publish it in QC.

Michael