Skip to content

Commit 5eeda96

Browse files
author
Colin Robertson
authored
Merge pull request #3842 from MicrosoftDocs/main637859857600025042
Repo sync for protected CLA branch
2 parents 578dd21 + 7d1ed24 commit 5eeda96

File tree

2 files changed

+43
-44
lines changed

2 files changed

+43
-44
lines changed

docs/build/reference/internal-partition.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,33 @@
11
---
22
title: "/internalPartition"
33
description: "Use the /internalPartition compiler option to treat the input file as an internal partition unit."
4-
ms.date: 04/15/2022
4+
ms.date: 04/18/2022
55
author: "tylermsft"
66
ms.author: "twhitney"
77
f1_keywords: ["/internalPartition", "VC.Project.VCCLCompilerTool.Interface"]
88
helpviewer_keywords: ["/internalPartition", "Translate include directives into import directives"]
99
---
1010
# `/internalPartition`
1111

12-
Use this switch to treat the input file on the command line as an [internal partition unit](http://eel.is/c%2B%2Bdraft/module#unit-4.3).
12+
Use the **`/internalPartition`** compiler option to treat the input file as an *internal partition unit*, which is a [module partition implementation unit](../../cpp/modules-cpp.md#implementing-modules) that doesn't contribute to the external interface of the module.
1313

1414
## Syntax
1515

1616
> **`/internalPartition`** *`filename`*
1717
1818
## Remarks
1919

20-
The following example demonstrates using the `/internalPartition` switch:
21-
22-
`m-internals.cpp`:
20+
The following example demonstrates how to use the `/internalPartition` option:
2321

2422
```cpp
23+
// m-internals.cpp
2524
module m:internals;
2625

2726
void internalFunc() {} // cannot have `export` since this is an internal partition
2827
```
2928

30-
`m.ixx`:
31-
3229
```cpp
30+
// m.ixx
3331
export module m;
3432
import :internals; // Cannot export this partition.
3533

@@ -43,7 +41,7 @@ To compile this interface:
4341
cl /std:c++latest /internalPartition /c m-internals.cpp
4442
```
4543

46-
This switch can't be used with the [`/interface`](interface.md) compiler switch.
44+
This option can't be used with the [`/interface`](interface.md) compiler option.
4745

4846
**`/internalPartition`** is available in Visual Studio 2019 version 16.10, or later.\
4947
**`/internalPartition`** requires [/std:c++20](std-specify-language-standard-version.md) or later.
Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,44 @@
11
---
22
description: "Learn more about: _matherr"
33
title: "_matherr"
4-
ms.date: "04/05/2018"
4+
ms.date: "04/18/2012"
55
api_name: ["_matherr"]
66
api_location: ["msvcrt.dll", "msvcr80.dll", "msvcr90.dll", "msvcr100.dll", "msvcr100_clr0400.dll", "msvcr110.dll", "msvcr110_clr0400.dll", "msvcr120.dll", "msvcr120_clr0400.dll", "ucrtbase.dll"]
77
api_type: ["DLLExport"]
88
topic_type: ["apiref"]
99
f1_keywords: ["_matherr", "matherr"]
1010
helpviewer_keywords: ["_matherr function", "matherr function"]
11-
ms.assetid: b600d66e-165a-4608-a856-8fb418d46760
1211
---
13-
# _matherr
12+
# `_matherr`
1413

1514
Handles math errors.
1615

1716
## Syntax
1817

1918
```C
20-
int _matherr( struct _exception * except );
19+
int _matherr(struct _exception *except);
2120
```
2221
2322
### Parameters
2423
25-
*except*<br/>
24+
*`except`*\
2625
Pointer to the structure containing error information.
2726
2827
## Return Value
2928
30-
**_matherr** returns 0 to indicate an error, or a nonzero value to indicate success. If **_matherr** returns 0, an error message can be displayed and **errno** is set to an appropriate error value. If **_matherr** returns a nonzero value, no error message is displayed and **errno** remains unchanged.
29+
**`_matherr`** returns 0 to indicate an error, or a nonzero value to indicate success:
30+
- If **`_matherr`** returns 0, an error message can be displayed and **`errno`** is set to an appropriate error value.
31+
- If **`_matherr`** returns a nonzero value, no error message is displayed and **`errno`** remains unchanged.
3132
32-
For more information about return codes, see [_doserrno, errno, _sys_errlist, and _sys_nerr](../../c-runtime-library/errno-doserrno-sys-errlist-and-sys-nerr.md).
33+
For more information about return codes, see [`_doserrno`, `errno`, `_sys_errlist`, and `_sys_nerr`](../../c-runtime-library/errno-doserrno-sys-errlist-and-sys-nerr.md).
3334
3435
## Remarks
3536
36-
The **_matherr** function processes errors generated by the floating-point functions of the math library. These functions call **_matherr** when an error is detected.
37+
The **`_matherr`** function processes errors generated by the floating-point functions of the math library. These functions call **`_matherr`** when an error is detected. This interaction isn't impacted by the [floating-point mode of the compiler](../../build/reference/fp-specify-floating-point-behavior.md) or the [floating point control word](../../c-runtime-library/reference/control87-controlfp-control87-2.md). Since **`_matherr`** is a library function, math [intrinsic functions](../../intrinsics/compiler-intrinsics.md) won't call it.
3738
38-
For special error handling, you can provide a different definition of **_matherr**. If you use the dynamically linked version of the C run-time library (CRT), you can replace the default **_matherr** routine in a client executable with a user-defined version. However, you cannot replace the default **_matherr** routine in a DLL client of the CRT DLL.
39+
For special error handling, you can provide a different definition of **`_matherr`**. If you use the dynamically linked version of the C run-time library (CRT), you can replace the default **`_matherr`** routine in a client executable with a user-defined version. However, you can't replace the default **`_matherr`** routine in a DLL client of the CRT DLL.
3940
40-
When an error occurs in a math routine, **_matherr** is called with a pointer to an **_exception** type structure (defined in \<math.h>) as an argument. The **_exception** structure contains the following elements.
41+
When an error occurs in a math routine, **`_matherr`** is called with a pointer to an **`_exception`** type structure (defined in `<math.h>`) as an argument. The **`_exception`** structure contains the following elements.
4142
4243
```C
4344
struct _exception
@@ -50,36 +51,36 @@ struct _exception
5051
};
5152
```
5253

53-
The **type** member specifies the type of math error. It is one of the following values, defined in \<math.h>:
54+
The **`type`** member specifies the type of math error. It's one of the following values, defined in `<math.h>`:
5455

5556
|Macro|Meaning|
5657
|-|-|
57-
| **_DOMAIN** | Argument domain error |
58-
| **_SING** | Argument singularity |
59-
| **_OVERFLOW** | Overflow range error |
60-
| **_PLOSS** | Partial loss of significance |
61-
| **_TLOSS** | Total loss of significance |
62-
| **_UNDERFLOW** | The result is too small to be represented. (This condition is not currently supported.) |
58+
| **`_DOMAIN`** | Argument domain error |
59+
| **`_SING`** | Argument singularity |
60+
| **`_OVERFLOW`** | Overflow range error |
61+
| **`_PLOSS`** | Partial loss of significance |
62+
| **`_TLOSS`** | Total loss of significance |
63+
| **`_UNDERFLOW`** | The result is too small to be represented. (This condition isn't currently supported.) |
6364

64-
The structure member **name** is a pointer to a null-terminated string containing the name of the function that caused the error. The structure members **arg1** and **arg2** specify the values that caused the error. If only one argument is given, it is stored in **arg1**.
65+
The structure member **`name`** is a pointer to a null-terminated string containing the name of the function that caused the error. The structure members **`arg1`** and **`arg2`** specify the values that caused the error. If only one argument is given, it's stored in **`arg1`**.
6566

66-
The default return value for the given error is **retval**. If you change the return value, it must specify whether an error actually occurred.
67+
The default return value for the given error is **`retval`**. If you change the return value, it must specify whether an error actually occurred.
6768

6869
## Requirements
6970

7071
|Routine|Required header|
7172
|-------------|---------------------|
72-
|**_matherr**|\<math.h>|
73+
|**`_matherr`**|`<math.h>`|
7374

7475
For more compatibility information, see [Compatibility](../../c-runtime-library/compatibility.md).
7576

7677
## Example
7778

7879
```C
79-
// crt_matherr.c
80-
/* illustrates writing an error routine for math
81-
* functions. The error function must be:
82-
* _matherr
80+
/* crt_matherr.c
81+
* Illustrates writing an error routine for math
82+
* functions.
83+
* The error handling function must be named _matherr
8384
*/
8485

8586
#include <math.h>
@@ -102,27 +103,27 @@ int main()
102103
* returns the natural or base-10 logarithm of the absolute value
103104
* of the argument and suppresses the usual error message.
104105
*/
105-
int _matherr( struct _exception *except )
106+
int _matherr(struct _exception *except)
106107
{
107108
/* Handle _DOMAIN errors for log or log10. */
108-
if( except->type == _DOMAIN )
109+
if (except->type == _DOMAIN)
109110
{
110-
if( strcmp( except->name, "log" ) == 0 )
111+
if (strcmp(except->name, "log") == 0)
111112
{
112-
except->retval = log( -(except->arg1) );
113-
printf( "Special: using absolute value: %s: _DOMAIN "
114-
"error\n", except->name );
113+
except->retval = log(-(except->arg1));
114+
printf("Special: using absolute value: %s: _DOMAIN "
115+
"error\n", except->name);
115116
return 1;
116117
}
117-
else if( strcmp( except->name, "log10" ) == 0 )
118+
else if (strcmp(except->name, "log10") == 0)
118119
{
119-
except->retval = log10( -(except->arg1) );
120-
printf( "Special: using absolute value: %s: _DOMAIN "
121-
"error\n", except->name );
120+
except->retval = log10(-(except->arg1));
121+
printf("Special: using absolute value: %s: _DOMAIN "
122+
"error\n", except->name);
122123
return 1;
123124
}
124125
}
125-
printf( "Normal: " );
126+
printf("Normal: ");
126127
return 0; /* Else use the default actions */
127128
}
128129
```
@@ -137,4 +138,4 @@ Normal: log( 0.0 ) = -inf
137138

138139
## See also
139140

140-
[Floating-Point Support](../../c-runtime-library/floating-point-support.md)<br/>
141+
[Floating-Point Support](../../c-runtime-library/floating-point-support.md)

0 commit comments

Comments
 (0)