Skip to content

Commit e4aa574

Browse files
author
Colin Robertson
authored
Merge pull request #3640 from MicrosoftDocs/main637770906162760917
Repo sync for protected CLA branch
2 parents 3a57514 + f3477d8 commit e4aa574

File tree

8 files changed

+119
-124
lines changed

8 files changed

+119
-124
lines changed

docs/build/reference/nmake-function-patsubst.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ $(patsubst %lo,Bye,Hello Hey Hi) # Evaluates to "Bye Hey Hi"
4949
# A wildcard can be used in the pattern without a wildcard in the replacement
5050

5151
$(patsubst he%,_%_,Hello Hey Hi) # Evaluates to "Hello Hey Hi" - patsubst is case-sensitive, so no substitutions performed
52-
$(patsubst he%,_%_,Hello Hey Hi) # Evaluates to "_llo_ _y_ Hi" - patsubsti is case-insensitive
52+
$(patsubsti he%,_%_,Hello Hey Hi) # Evaluates to "_llo_ _y_ Hi" - patsubsti is case-insensitive
5353

5454
# patsubsti is commonly used to change the file extensions of a list of files
5555
OBJ_FILES=$(patsubst %.c,%.obj,$(C_SOURCES)) $(patsubst %.cpp,%.obj,$(patsubst %.cxx,%.obj,$(CPP_SOURCES)))

docs/c-runtime-library/reference/alloca.md

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
---
22
description: "Learn more about: _alloca"
33
title: "_alloca"
4-
ms.date: "11/04/2016"
4+
ms.date: 01/05/2022
55
api_name: ["_alloca"]
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: ["_alloca", "alloca"]
1010
helpviewer_keywords: ["memory allocation, stack", "alloca function", "_alloca function"]
11-
ms.assetid: 74488eb1-b71f-4515-88e1-cdd03b6f8225
1211
---
1312
# `_alloca`
1413

@@ -24,20 +23,20 @@ void *_alloca(
2423

2524
### Parameters
2625

27-
*`size`*<br/>
26+
*`size`*\
2827
Bytes to be allocated from the stack.
2928

3029
## Return Value
3130

3231
The **`_alloca`** routine returns a **`void`** pointer to the allocated space, which is guaranteed to be suitably aligned for storage of any type of object. If *`size`* is 0, **`_alloca`** allocates a zero-length item and returns a valid pointer to that item.
3332

34-
A stack overflow exception is generated if the space cannot be allocated. The stack overflow exception is not a C++ exception; it is a structured exception. Instead of using C++ exception handling, you must use [Structured Exception Handling](../../cpp/structured-exception-handling-c-cpp.md) (SEH).
33+
A stack overflow exception is generated if the space can't be allocated. The stack overflow exception isn't a C++ exception; it's a structured exception. Instead of using C++ exception handling, you must use [Structured Exception Handling](../../cpp/structured-exception-handling-c-cpp.md) (SEH).
3534

3635
## Remarks
3736

3837
**`_alloca`** allocates *`size`* bytes from the program stack. The allocated space is automatically freed when the calling function exits (not when the allocation merely passes out of scope). Therefore, do not pass the pointer value returned by **`_alloca`** as an argument to [`free`](free.md).
3938

40-
There are restrictions to explicitly calling **`_alloca`** in an exception handler (EH). EH routines that run on x86-class processors operate in their own memory frame: They perform their tasks in memory space that is not based on the current location of the stack pointer of the enclosing function. The most common implementations include Windows NT structured exception handling (SEH) and C++ catch clause expressions. Therefore, explicitly calling **`_alloca`** in any of the following scenarios results in program failure during the return to the calling EH routine:
39+
There are restrictions to explicitly calling **`_alloca`** in an exception handler (EH). EH routines that run on x86-class processors operate in their own memory frame: They perform their tasks in memory space that isn't based on the current location of the stack pointer of the enclosing function. The most common implementations include Windows NT structured exception handling (SEH) and C++ catch clause expressions. Therefore, explicitly calling **`_alloca`** in any of the following scenarios results in program failure during the return to the calling EH routine:
4140

4241
- Windows NT SEH exception filter expression: `__except ( _alloca() )`
4342

@@ -50,7 +49,7 @@ However, **`_alloca`** can be called directly from within an EH routine or from
5049
> [!IMPORTANT]
5150
> In Windows XP, if **`_alloca`** is called inside a try/catch block, you must call [`_resetstkoflw`](resetstkoflw.md) in the catch block.
5251
53-
In addition to the above restrictions, when using the[`/clr` (Common Language Runtime Compilation)](../../build/reference/clr-common-language-runtime-compilation.md) option, **`_alloca`** cannot be used in **`__except`** blocks. For more information, see [`/clr` Restrictions](../../build/reference/clr-restrictions.md).
52+
In addition to the above restrictions, when using the[`/clr` (Common Language Runtime Compilation)](../../build/reference/clr-common-language-runtime-compilation.md) option, **`_alloca`** can't be used in **`__except`** blocks. For more information, see [`/clr` Restrictions](../../build/reference/clr-restrictions.md).
5453

5554
## Requirements
5655

@@ -103,7 +102,7 @@ int main()
103102

104103
// If the stack overflows, use this function to restore.
105104
errcode = _resetstkoflw();
106-
if (errcode)
105+
if (errcode == 0) // _resetstkoflw() returns 0 on failure
107106
{
108107
printf_s("Could not reset the stack!\n");
109108
_exit(1);
@@ -118,9 +117,9 @@ Allocated 1000 bytes of stack at 0x0012FB50
118117

119118
## See also
120119

121-
[Memory Allocation](../../c-runtime-library/memory-allocation.md)<br/>
122-
[`calloc`](calloc.md)<br/>
123-
[`malloc`](malloc.md)<br/>
124-
[`realloc`](realloc.md)<br/>
125-
[`_resetstkoflw`](resetstkoflw.md)<br/>
126-
[`_malloca`](malloca.md)<br/>
120+
[Memory Allocation](../../c-runtime-library/memory-allocation.md)\
121+
[`calloc`](calloc.md)\
122+
[`malloc`](malloc.md)\
123+
[`realloc`](realloc.md)\
124+
[`_resetstkoflw`](resetstkoflw.md)\
125+
[`_malloca`](malloca.md)

docs/cpp/new-operator-cpp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ The **`new`** operator can't be used to allocate a function, but it can be used
6565

6666
```cpp
6767
int (**p) () = new (int (*[7]) ());
68-
delete *p;
68+
delete p;
6969
```
7070

7171
If you use the operator **`new`** without any extra arguments, and compile with the [`/GX`](../build/reference/gx-enable-exception-handling.md), [`/EHa`](../build/reference/eh-exception-handling-model.md), or [`/EHs`](../build/reference/eh-exception-handling-model.md) option, the compiler generates code to call operator **`delete`** if the constructor throws an exception.

0 commit comments

Comments
 (0)