Mentions légales du service

Skip to content
Snippets Groups Projects

Introduce maybe_unused.

Merged GILLES Sebastien requested to merge sgilles/gettingstartedwithmoderncpp:137_main into master
3 unresolved threads

New section below the main function to introduce the maybe_unused keyword.

Closes #137 (closed).

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
  • Very minor wording corrections, otherwise all good :)

  • added 1 commit

    Compare with previous version

  • Thanks!

    I have pushed a version with the fixes. I have taken all into account save the ones with quotes, which is an artifact from Jupyter format (no formatting issue when working on the notebook)

  • Thanks for the corrections, good to merge! :grinning:

    Edited by DIAZ Jerome
  • DIAZ Jerome approved this merge request

    approved this merge request

  • GILLES Sebastien resolved all threads

    resolved all threads

  • mentioned in commit f2014dc5

  • 1430 " return EXIT_SUCCESS;\n",
    1431 "}"
    1432 ]
    1433 },
    1434 {
    1435 "cell_type": "markdown",
    1436 "metadata": {},
    1437 "source": [
    1438 "To counteract this you have three strategies:"
    1439 ]
    1440 },
    1441 {
    1442 "cell_type": "markdown",
    1443 "metadata": {},
    1444 "source": [
    1445 "### Not naming the parameters"
  • 1454 "%%cppmagics --print_command clang\n",
    1455 "\n",
    1456 "#include <cstdlib>\n",
    1457 "\n",
    1458 "int main(int , char** )\n",
    1459 "{\n",
    1460 "\n",
    1461 " return EXIT_SUCCESS;\n",
    1462 "}"
    1463 ]
    1464 },
    1465 {
    1466 "cell_type": "markdown",
    1467 "metadata": {},
    1468 "source": [
    1469 "### Casting the parameters to void"
  • 1480 "#include <cstdlib>\n",
    1481 "\n",
    1482 "int main(int argc, char** argv)\n",
    1483 "{\n",
    1484 " static_cast<void>(argc);\n",
    1485 " static_cast<void>(argv);\n",
    1486 "\n",
    1487 " return EXIT_SUCCESS;\n",
    1488 "}"
    1489 ]
    1490 },
    1491 {
    1492 "cell_type": "markdown",
    1493 "metadata": {},
    1494 "source": [
    1495 "### Using [[maybe_unused]] (since C++ 17)"
    Please register or sign in to reply
    Loading