Skip to content

Commit f5c6d85

Browse files
authored
Undo update.
1 parent 9a27d85 commit f5c6d85

1 file changed

Lines changed: 6 additions & 10 deletions

File tree

docs/cpp/void-cpp.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Learn more about: void (C++)"
33
title: "void (C++)"
4-
ms.date: 12/12/2022
4+
ms.date: 10/15/2021
55
f1_keywords: ["void_cpp"]
66
helpviewer_keywords: ["void keyword [C++]", "functions [C++], void", "pointers, void"]
77
ms.assetid: d203edba-38e6-4056-8b89-011437351057
@@ -16,26 +16,22 @@ In C++, a **`void`** pointer can point to a free function (a function that's not
1616

1717
You can't declare a variable of type **`void`**.
1818

19-
As a matter of style, the C++ Core Guidelines recommend you don't use **`void`** to specify an empty formal parameter list. For more information, see [C++ Core Guidelines NL.25: Don't use `void` as an argument type](https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#nl25-dont-use-void-as-an-argument-type).
20-
2119
## Example
2220

2321
```cpp
24-
// void.cpp
25-
26-
void return_nothing()
22+
void print_num(int num)
2723
{
28-
// A void function can have a return with no argument,
29-
// or no return statement.
24+
std::cout << num << std::endl;
3025
}
3126

27+
// void.cpp
3228
void vobject; // C2182
3329
void *pv; // okay
3430
int *pint; int i;
35-
int main()
31+
int main(void)
3632
{
3733
pv = &i;
38-
// Cast is optional in C, required in C++
34+
// Cast optional in C required in C++
3935
pint = (int *)pv;
4036
}
4137
```

0 commit comments

Comments
 (0)