What does this statement //! [number] mean?

c++

Solution

I'm only guessing since you don't show more complete code (or in this case more complete comment).

Doxygen is a documentation generator that parsers code declarations and comments of a specific format. If you read this part of the manual you will see that it recognizes `//!` as a special comment that contains documentation. Doxygen supports markdown which have links inside square brackets.

So this is nothing related to actual code, other than to help document it. And it's certainly not a statement that the compiler will try to generate code for.

Problem

I have seen In many project some programmers use `//! [1]`, `//! [2]`, ..., `//! [n]` in their code but I have no idea what this could mean. I’ll be grateful if someone point out the use of those comments. this is a snipe code: ``` BlockingClient::BlockingClient(QWidget *parent) : QWidget(parent) { hostLabel = new QLabel(tr("&Server name:")); portLabel = new QLabel(tr("S&erver port:")); QString ipAddress; QList<QHostAddress> ipAddressesList = QNetworkInterface::allAddresses(); // use the first non-localhost IPv4 address for (int i = 0; i < ipAddressesList.size(); ++i) { } // if we did not find one, use IPv4 localhost if (ipAddress.isEmpty()) ipAddress = QHostAddress(QHostAddress::LocalHost).toString(); //... connect(hostLineEdit, SIGNAL(textChanged(QString)), this, SLOT(enableGetFortuneButton())); connect(portLineEdit, SIGNAL(textChanged(QString)), this, SLOT(enableGetFortuneButton())); //! [0] connect(&thread, SIGNAL(newFortune(QString)), this, SLOT(showFortune(QString))); //! [0] //! [1] connect(&thread, SIGNAL(error(int,QString)), this, SLOT(displayError(int,QString))); //! [1] QGridLayout *mainLayout = new QGridLayout; mainLayout->addWidget(hostLabel, 0, 0); setLayout(mainLayout); setWindowTitle(tr("Blocking Fortune Client")); portLineEdit->setFocus(); } //! [2] void BlockingClient::requestNewFortune() { getFortuneButton->setEnabled(false); thread.requestNewFortune(hostLineEdit->text(), portLineEdit->text().toInt()); } //! [2] //! [3] void BlockingClient::showFortune(const QString &nextFortune) { if (nextFortune == currentFortune) { requestNewFortune(); return; } //! [3] //! [4] currentFortune = nextFortune; statusLabel->setText(currentFortune); getFortuneButton->setEnabled(true); } //! [4] ```

Original source