Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ jobs:
deploy:
needs: build
runs-on: ubuntu-latest
if: github.repository == 'cppdoc-cc/cppdoc'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
---
title: Comments
description: Auto‑generated from cppreference
cppdoc:
keys: ["cpp.lang.comments"]
---

import { Desc, DescList, DocLink } from '@components/index';

# Comments
import { Decl, DeclDoc } from "@components/decl-doc";

Comments serve as a sort of in-code documentation. When inserted into a program, they are effectively ignored by the compiler; they are solely intended to be used as notes by the humans that read source code. Although specific documentation is not part of the C++ standard, several utilities exist that parse comments with different documentation formats.

## Syntax

#### Block Comment
Often known as "C-style" or "multi-line" comments.

```
/* comment */
```
#### Single-line Comment
Often known as "C++-style" or "single-line" comments.
```
// comment
```
<DeclDoc>
<Decl slot="decl">
```cpp
/* comment */
```
</Decl>

Often known as "C-style" or "multi-line" comments.
</DeclDoc>

<DeclDoc>
<Decl slot="decl">
```cpp
// comment
```
</Decl>
Often known as "C++-style" or "single-line" comments.
</DeclDoc>

All comments are removed from the program at <DocLink src="/cpp/language/translation_phases">translation phase 3</DocLink> by replacing each comment with a single whitespace character.

Expand Down
19 changes: 18 additions & 1 deletion src/content/docs/cpp/language/main_function.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import Code from "@astrojs/starlight/components";
import Behavior from "@components/Behavior.astro";
import { Decl, DeclDoc } from "@components/decl-doc";
import { DR, DRList } from "@components/defect-report";
import { Desc, DescList, DocLink } from '@components/index';
import Missing from "@components/Missing.astro";
import { ParamDoc, ParamDocList } from "@components/param-doc";
import { Revision } from "@components/revision";
Expand Down Expand Up @@ -131,8 +132,16 @@ argv[3] == 0

## References

- C++23 standard (ISO/IEC 14882:2024):
<DeclDoc style="text-align: center;">
<Decl slot="decl">
<div style="text-align: center;">
<strong>Extended Content</strong>
</div>
</Decl>

- C++23 standard (ISO/IEC 14882:2024)
- 6.9.3.1 main function [basic.start.main]
</DeclDoc>

## Defect reports

Expand Down Expand Up @@ -175,3 +184,11 @@ The following behavior-changing defect reports were applied retroactively to pre
</Fragment>
</DR>
</DRList>

## See also

<DescList>
<Desc>
<DocLink slot="item" src="/c/language/main_function"> C documentation</DocLink> for <span> **main function** </span>
</Desc>
</DescList>