简体   繁体   中英

c++ - Weird Comment In wxWidgets

I found a weird pattern of comment symbol in wxWidgets codes generated in code blocks and some parts of it is also being executed by the compiler.

What actually is this symbol, what it do and what it's called?

//(* ... //*)

Here is the example of how it is implemented in the app's source code:

//(*AppInitialize
bool wxsOK = true;
wxInitAllImageHandlers();
if ( wxsOK )
{
    teesrtFrame* Frame = new teesrtFrame(0);
    Frame->Show();
    SetTopWindow(Frame);
}
//*)

The word AppInitialize seems to be ignored, but all of the valid codes are compiled.

EDIT:

I hope this image can explain more about my doubt. 在此处输入图片说明

That's wxSmith code. From its docs :

This is a block of code that is automatically generated by wxSmith. Every block starts with a //( BlockName comment and ends with a // ). You may find other similar blocks in both header and source files. If you change their content, all changes will be lost next time you change something in the editor. These comments and everything inside them belong to wxSmith, so don't mess with them.

//(*AppInitialize  -- > Inline comments start with // 
bool wxsOK = true;
wxInitAllImageHandlers();
if ( wxsOK )
{
    teesrtFrame* Frame = new teesrtFrame(0);
    Frame->Show();
    SetTopWindow(Frame);
}
//*)  --> inline comment start with //

They are inline comments.

if anything start with // then leave the rest of the line. It is a comment. (* and *) has nothing to do with it.

There's really nothing to it. // starts a comment that lasts until the end of the line - everything on the line after // is simply ignored by the compiler.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM