Discussion:
You folks are gonna love this one
(too old to reply)
Colin B Maharaj
2008-07-08 12:13:58 UTC
Permalink
Create a form, place a button on it and copy this code
in the button event handler. You are supposed to see
a Path in a message box but you don't.

(Tested in BCB6 and BCB3 - This is the compilers I have)

Oh and leave in the comments exactly as you see it..

//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString A = ParamStr(0); // example of A=C:\MyPath\MyProg.exe
AnsiString P = ExtractFilePath(A); // example of P=C:\MyPath\
ShowMessage(P);
}
//---------------------------------------------------------------------------

Question? Is this a bug or an oil-and-water situation
in that don't try to mix them - it won't work.

BTW: This code was based on some concepts that I was trying to
explain to someone, only to my surprise, I looked more like an
idiot than an expert. FOR HALF AN HOUR NO DOUBT!!

Colin B Maharaj
Trinidad, WI
Alan Bellingham
2008-07-08 12:34:45 UTC
Permalink
Post by Colin B Maharaj
AnsiString P = ExtractFilePath(A); // example of P=C:\MyPath\
ShowMessage(P);
Question? Is this a bug or an oil-and-water situation
in that don't try to mix them - it won't work.
Were you expecting the ShowMessage call to work? Because I think you
should find that it never gets called.

Hint: what's the last character in the previous line? What does that
character do?

Alan Bellingham
--
Team Browns
ACCU Conference 2009: to be announced
Colin B Maharaj
2008-07-08 13:08:56 UTC
Permalink
Oh I get it now... :)
Post by Alan Bellingham
Post by Colin B Maharaj
AnsiString P = ExtractFilePath(A); // example of P=C:\MyPath\
ShowMessage(P);
Question? Is this a bug or an oil-and-water situation
in that don't try to mix them - it won't work.
Were you expecting the ShowMessage call to work? Because I think you
should find that it never gets called.
Hint: what's the last character in the previous line? What does that
character do?
Alan Bellingham
Alan Bellingham
2008-07-08 14:00:10 UTC
Permalink
Post by Colin B Maharaj
Oh I get it now... :)
An annoying one, isn't it? What's even more annoying is that an
invisible change can totally change the effect: a trailing blank space
would have stopped the concatenation.

Some editors remove such trailing white space as a matter of course.

Alan Bellingham
--
Team Browns
ACCU Conference 2009: to be announced
Roddy Pratt
2008-07-09 10:21:13 UTC
Permalink
Post by Alan Bellingham
An annoying one, isn't it? What's even more annoying is that an
invisible change can totally change the effect: a trailing blank space
would have stopped the concatenation.
There *is* an IDE bug here though: The syntax colouring fails to make
the showmessage line as a comment. I'll QC that one.

I didn't see the problem until I built the code and noticed the
Showmessage line was not breakpointable.

- Roddy
Roddy Pratt
2008-07-09 10:30:20 UTC
Permalink
Post by Roddy Pratt
I'll QC that one.
Report No: 64262 Status: Reported
Syntax highlighter doesn't detect multi-line comments that use trailing
backslash.
http://qc.codegear.com/wc/qcmain.aspx?d=64262
qcwin:DEFECT_NO=64262


- Roddy
Leo Siefert
2008-07-09 13:37:41 UTC
Permalink
Report No: 64262 Status: Open
Syntax highlighter doesn't detect multi-line comments that use
trailing backslash.
http://qc.codegear.com/wc/qcmain.aspx?d=64262
QCWIN:Defect_No=64262

- Leo
Fraser Ross
2008-07-09 15:37:43 UTC
Permalink
Is it possible to add a report to my tracking list or is that not fully
implemented? Where it says 'You are logged in as' nothings follows.

Fraser.
Leo Siefert
2008-07-10 11:49:52 UTC
Permalink
Post by Fraser Ross
Is it possible to add a report to my tracking list
You should be able to right-click on the inscrutable icon above the
workaround tab in the win client and select a tracking option for the
report.

You can also set up automated tracking options for reports that you
enter, modify, comment on, rate or vote for under Reports |
Notifications/
Post by Fraser Ross
Where it says 'You are logged in as' nothings follows.
Are you using the web client? If so, it sounds as if you have not
logged in. Unfortunately I can't help you with the web client - I have
never been able to figure out how to use it at all.

I suggest that you switch to one of the thick clients, at least until
the long promised updated web client is actually released as there
have been many issues reported with the existing one and almost no
maintenance.

- Leo

Alan Bellingham
2008-07-09 11:16:23 UTC
Permalink
Post by Roddy Pratt
There *is* an IDE bug here though: The syntax colouring fails to make
the showmessage line as a comment. I'll QC that one.
Ah, I was using my Mk. 1 eyeball on the code in the newsreader. It never
got near the IDE.

It can be an absolute pig of a job for an IDE to get everything right.
I'd love the IDE to get "#if 0 ... #endif" code right. And then "#define
FOO 0 ... #if FOO ... #endif".

Alan Bellingham
--
Team Browns
ACCU Conference 2009: to be announced
Roddy Pratt
2008-07-09 11:19:46 UTC
Permalink
Post by Alan Bellingham
It can be an absolute pig of a job for an IDE to get everything right.
Surprisingly, it did get

#pr\
agma

right, so it's nearly there!

- Roddy
Hendrik Schober
2008-07-10 08:49:22 UTC
Permalink
Post by Alan Bellingham
Post by Roddy Pratt
There *is* an IDE bug here though: The syntax colouring fails to make
the showmessage line as a comment. I'll QC that one.
Ah, I was using my Mk. 1 eyeball on the code in the newsreader. It never
got near the IDE.
It can be an absolute pig of a job for an IDE to get everything right.
I'd love the IDE to get "#if 0 ... #endif" code right. And then "#define
FOO 0 ... #if FOO ... #endif".
I have one that does (mostly), and it annoys me.
Post by Alan Bellingham
Alan Bellingham
Schobi
Hans Galema
2008-07-08 12:32:40 UTC
Permalink
Post by Colin B Maharaj
AnsiString P = ExtractFilePath(A); // example of P=C:\MyPath\
You forgot to add the compiler warning:

[C++ Warning] Unit1.cpp(21): W8010 Continuation character \ found in // comment

Which says it all.

You could as well have written:

AnsiString P = ExtractFilePath(A); // \
ShowMessage(P);
BigStew
2008-07-08 12:41:42 UTC
Permalink
Post by Colin B Maharaj
Create a form, place a button on it and copy this code
in the button event handler. You are supposed to see
a Path in a message box but you don't.
(Tested in BCB6 and BCB3 - This is the compilers I have)
Oh and leave in the comments exactly as you see it..
//--------------------------------------------------------------------------
-
Post by Colin B Maharaj
void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString A = ParamStr(0); // example of A=C:\MyPath\MyProg.exe
AnsiString P = ExtractFilePath(A); // example of P=C:\MyPath\
ShowMessage(P);
}
//--------------------------------------------------------------------------
-

It's the comment continuation character "\" at the end of the second comment
that is causing the ShowMessage() to be treated as a comment, and therefore
the code is never executed.
The help file is quite clear about this...
This warning message is issued when a C++ // comment is continued onto the
next line with backslash line continuation.

The intention is to warn about cases where lines containing source code
unintentionally become part of a comment because that comment happened to
end in a backslash.

If you get this warning, check carefully whether you intend the line after
the // comment to be part of the comment. If you don't, either remove the
backslash or put some other character after it. If you do, it's probably
better coding style to start the next comment line with // also.

Stewart
Eliot Frank
2008-07-09 13:24:19 UTC
Permalink
Post by Colin B Maharaj
void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString A = ParamStr(0); // example of A=C:\MyPath\MyProg.exe
AnsiString P = ExtractFilePath(A); // example of P=C:\MyPath\
ShowMessage(P);
}
//----------------------------------------------------------
The most evil thing Microsoft ever did was make backslash the path
separator character.
Alan Bellingham
2008-07-09 14:01:21 UTC
Permalink
Post by Eliot Frank
The most evil thing Microsoft ever did was make backslash the path
separator character.
And *most* of the time, you can use the forward slash instead anyway.
It's the shell that has the stupid insistence on doing things
backasswards.

Alan Bellingham
--
Team Browns
ACCU Conference 2009: to be announced
Loading...