styrofoam fly
styrofoam fly

Reputation: 608

//! [0] C++ - what is it?

what does //! [0] do in C++? I believe it's something that changes the language defaults, like turning off lazy evaluation or something, but I don't know exactly. Something with arrays?

Upvotes: 7

Views: 715

Answers (2)

Lol4t0
Lol4t0

Reputation: 12547

That's a comment of course. Still it has a special meaning for doxygen:

\snippet ( block_id )

Where the \include command can be used to include a complete file as source code, this command can be used to quote only a fragment of a source file.

For example, the putting the following command in the documentation, references a snippet in file example.cpp residing in a subdirectory which should be pointed to by EXAMPLE_PATH.

\snippet snippets/example.cpp Adding a resource

The text following the file name is the unique identifier for the snippet. This is used to delimit the quoted code in the relevant snippet file as shown in the following example that corresponds to the above \snippet command:

QImage image(64, 64, QImage::Format_RGB32);
image.fill(qRgb(255, 160, 128));
//! [Adding a resource]
document->addResource(QTextDocument::ImageResource,
    QUrl("mydata://image.png"), QVariant(image));
//! [Adding a resource]
...

Note that the lines containing the block markers will not be included, so the output will be:

document->addResource(QTextDocument::ImageResource,
QUrl("mydata://image.png"), QVariant(image));

Note also that the [block_id] markers should appear exactly twice in the source file.

Here 0 is the block id.

Upvotes: 39

akonsu
akonsu

Reputation: 29546

It is a single-line comment...

Upvotes: 8

Related Questions