Skip to content

Commit cce52b2

Browse files
authored
Merge pull request MicrosoftDocs#1647 from MicrosoftDocs/master
1/4/2019 AM Publish
2 parents fe1e21d + e067f4e commit cce52b2

5 files changed

Lines changed: 118 additions & 108 deletions

File tree

‎docs/assembler/masm/align-masm.md‎

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,27 @@
11
---
22
title: "ALIGN (MASM)"
3-
ms.date: "08/30/2018"
3+
ms.date: "01/02/2019"
44
f1_keywords: ["align"]
55
helpviewer_keywords: ["ALIGN directive"]
66
ms.assetid: 1c386b23-439f-4ec3-a6de-74427b25e47f
77
---
88
# ALIGN (MASM)
99

10-
Aligns the next variable or instruction on a byte that is a multiple of *number*.
10+
The **ALIGN** directive aligns the next data element or instruction on an address that is a multiple of its parameter. The parameter must be a power of 2 (for example, 1, 2, 4, and so on) that is less than or equal to the segment alignment.
1111

1212
## Syntax
1313

1414
> ALIGN [[*number*]]
1515
16+
## Remarks
17+
18+
The **ALIGN** directive allows you to specify the beginning offset of a data element or an instruction. Aligned data can improve performance, at the expense of wasted space between data elements. Large performance improvements can be seen when data accesses are on boundaries that fit within cache lines. Accesses on natural boundaries for native types means less time spent in internal hardware realignment microcode.
19+
20+
The need for aligned instructions is rare on modern processors that use a flat addressing model, but may be required for jump targets in older code for other addressing models.
21+
22+
When data is aligned, the skipped space is padded with zeroes. When instructions are aligned, the skipped space is filled with appropriately-sized NOP instructions.
23+
1624
## See also
1725

26+
[EVEN](even.md)<br/>
1827
[Directives Reference](../../assembler/masm/directives-reference.md)<br/>

‎docs/c-runtime-library/reference/fopen-wfopen.md‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -129,25 +129,25 @@ The following options can be appended to *mode* to specify additional behaviors.
129129

130130
Valid characters for the *mode* string that is used in **fopen** and **_fdopen** correspond to *oflag* arguments that are used in [_open](open-wopen.md) and [_sopen](sopen-wsopen.md), as follows.
131131

132-
|Characters in *mode* string|Equivalent *oflag* value for _open/_sopen|
132+
|Characters in *mode* string|Equivalent *oflag* value for \_open/\_sopen|
133133
|-------------------------------|----------------------------------------------------|
134-
|**a**|**_O_WRONLY** &#124; **_O_APPEND** (usually **_O_WRONLY** &#124; **_O_CREAT** &#124;** _O_APPEND**)|
135-
|**a+**|**_O_RDWR** &#124; **_O_APPEND** (usually **_O_RDWR** &#124; **_O_APPEND** &#124; **_O_CREAT** )|
136-
|**r**|**_O_RDONLY**|
137-
|**r+**|**_O_RDWR**|
138-
|**w**|**_O_WRONLY** (usually **_O_WRONLY** &#124; **_O_CREAT** &#124;** _O_TRUNC**)|
139-
|**w+**|**_O_RDWR** (usually **_O_RDWR** &#124; **_O_CREAT** &#124; **_O_TRUNC**)|
140-
|**b**|**_O_BINARY**|
141-
|**t**|**_O_TEXT**|
134+
|**a**|**\_O\_WRONLY** &#124; **\_O\_APPEND** (usually **\_O\_WRONLY** &#124; **\_O\_CREAT** &#124; **\_O\_APPEND**)|
135+
|**a+**|**\_O\_RDWR** &#124; **\_O\_APPEND** (usually **\_O\_RDWR** &#124; **\_O\_APPEND** &#124; **\_O\_CREAT** )|
136+
|**r**|**\_O\_RDONLY**|
137+
|**r+**|**\_O\_RDWR**|
138+
|**w**|**\_O\_WRONLY** (usually **\_O\_WRONLY** &#124; **\_O\_CREAT** &#124; **\_O\_TRUNC**)|
139+
|**w+**|**\_O\_RDWR** (usually **\_O\_RDWR** &#124; **\_O\_CREAT** &#124; **\_O\_TRUNC**)|
140+
|**b**|**\_O\_BINARY**|
141+
|**t**|**\_O\_TEXT**|
142142
|**c**|None|
143143
|**n**|None|
144-
|**S**|**_O_SEQUENTIAL**|
145-
|**R**|**_O_RANDOM**|
146-
|**T**|**_O_SHORTLIVED**|
147-
|**D**|**_O_TEMPORARY**|
148-
|**ccs=UNICODE**|**_O_WTEXT**|
149-
|**ccs=UTF-8**|**_O_UTF8**|
150-
|**ccs=UTF-16LE**|**_O_UTF16**|
144+
|**S**|**\_O\_SEQUENTIAL**|
145+
|**R**|**\_O\_RANDOM**|
146+
|**T**|**\_O\_SHORTLIVED**|
147+
|**D**|**\_O\_TEMPORARY**|
148+
|**ccs=UNICODE**|**\_O\_WTEXT**|
149+
|**ccs=UTF-8**|**\_O\_UTF8**|
150+
|**ccs=UTF-16LE**|**\_O\_UTF16**|
151151

152152
If you are using **rb** mode, you do not have to port your code, and if you expect to read most of a large file or are not concerned about network performance, you might also consider whether to use memory mapped Win32 files as an option.
153153

‎docs/c-runtime-library/reference/setmode.md‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ For more information about these and other return codes, see [_doserrno, errno,
4141

4242
The **_setmode** function sets to *mode* the translation mode of the file given by *fd*. Passing **_O_TEXT** as *mode* sets text (that is, translated) mode. Carriage return-line feed (CR-LF) combinations are translated into a single line feed character on input. Line feed characters are translated into CR-LF combinations on output. Passing **_O_BINARY** sets binary (untranslated) mode, in which these translations are suppressed.
4343

44-
You can also pass **_O_U16TEXT**, **_O_U8TEXT**, or **_O_WTEXT** to enable Unicode mode, as demonstrated in the second example later in this document. **_setmode** is typically used to modify the default translation mode of **stdin** and **stdout**, but you can use it on any file. If you apply **_setmode** to the file descriptor for a stream, call **_setmode** before you perform any input or output operations on the stream.
44+
You can also pass **_O_U16TEXT**, **_O_U8TEXT**, or **_O_WTEXT** to enable Unicode mode, as demonstrated in the second example later in this document.
45+
46+
> [!CAUTION]
47+
> Unicode mode is for wide print functions (for example, `wprintf`) and is not supported for narrow print functions. Use of a narrow print function on a Unicode mode stream triggers an assert.
48+
49+
**_setmode** is typically used to modify the default translation mode of **stdin** and **stdout**, but you can use it on any file. If you apply **_setmode** to the file descriptor for a stream, call **_setmode** before you perform any input or output operations on the stream.
4550

4651
> [!CAUTION]
4752
> If you write data to a file stream, explicitly flush the code by using [fflush](fflush.md) before you use **_setmode** to change the mode. If you do not flush the code, you might get unexpected behavior. If you have not written data to the stream, you do not have to flush the code.

‎docs/cpp/cpp-language-reference.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ ms.assetid: 4be9cacb-c862-4391-894a-3a118c9c93ce
77
---
88
# C++ Language Reference
99

10-
This reference explains the C++ programming language as implemented in Microsoft Visual C++. The organization is based on *The Annotated C++ Reference Manual* by Margaret Ellis and Bjarne Stroustrup and on the ANSI/ISO C++ International Standard (ISO/IEC FDIS 14882). Microsoft-specific implementations of C++ language features are included.
10+
This reference explains the C++ programming language as implemented in Microsoft Visual C++. The organization is based on [*The Annotated C++ Reference Manual*](http://www.stroustrup.com/arm.html) by Margaret Ellis and Bjarne Stroustrup and on the ANSI/ISO C++ International Standard (ISO/IEC FDIS 14882). Microsoft-specific implementations of C++ language features are included.
1111

1212
For an overview of Modern C++ programming practices, see [Welcome Back to C++](welcome-back-to-cpp-modern-cpp.md).
1313

@@ -101,4 +101,4 @@ A list of links to the reference start pages for the various Visual C++ librarie
101101

102102
## See also
103103

104-
[C Language Reference](../c-language/c-language-reference.md)
104+
[C Language Reference](../c-language/c-language-reference.md)

‎docs/text/how-to-convert-between-various-string-types.md‎

Lines changed: 83 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -476,98 +476,94 @@ int main()
476476
// Set up a multibyte CStringA string.
477477
CStringA origa("Hello, World!");
478478
cout << origa << " (CStringA)" << endl;
479-
```
479+
480+
// Set up a wide character CStringW string.
481+
CStringW origw("Hello, World!");
482+
wcout << (LPCTSTR)origw << _T(" (CStringW)") << endl;
480483

481-
```cpp
482-
// Set up a wide character CStringW string.
483-
CStringW origw("Hello, World!");
484-
wcout << (LPCTSTR)origw << _T(" (CStringW)") << endl;
485-
486-
// Convert to a char* string from CStringA string
487-
// and display the result.
488-
const size_t newsizea = (origa.GetLength() + 1);
489-
char *nstringa = new char[newsizea];
490-
strcpy_s(nstringa, newsizea, origa);
491-
cout << nstringa << " (char *)" << endl;
492-
493-
// Convert to a char* string from a wide character
494-
// CStringW string. To be safe, we allocate two bytes for each
495-
// character in the original string, including the terminating
496-
// null.
497-
const size_t newsizew = (origw.GetLength() + 1)*2;
498-
char *nstringw = new char[newsizew];
499-
size_t convertedCharsw = 0;
500-
wcstombs_s(&convertedCharsw, nstringw, newsizew, origw, _TRUNCATE );
501-
cout << nstringw << " (char *)" << endl;
502-
503-
// Convert to a wchar_t* from CStringA
504-
size_t convertedCharsa = 0;
505-
wchar_t *wcstring = new wchar_t[newsizea];
506-
mbstowcs_s(&convertedCharsa, wcstring, newsizea, origa, _TRUNCATE);
507-
wcout << wcstring << _T(" (wchar_t *)") << endl;
508-
509-
// Convert to a wide character wchar_t* string from
510-
// a wide character CStringW string.
511-
wchar_t *n2stringw = new wchar_t[newsizew];
512-
wcscpy_s( n2stringw, newsizew, origw );
513-
wcout << n2stringw << _T(" (wchar_t *)") << endl;
514-
515-
// Convert to a wide character _bstr_t string from
516-
// a multibyte CStringA string.
517-
_bstr_t bstrt(origa);
518-
bstrt += _T(" (_bstr_t)");
519-
wcout << bstrt << endl;
520-
521-
// Convert to a wide character_bstr_t string from
522-
// a wide character CStringW string.
523-
bstr_t bstrtw(origw);
524-
bstrtw += " (_bstr_t)";
525-
wcout << bstrtw << endl;
526-
527-
// Convert to a wide character CComBSTR string from
528-
// a multibyte character CStringA string.
529-
CComBSTR ccombstr(origa);
530-
if (ccombstr.Append(_T(" (CComBSTR)")) == S_OK)
531-
{
532-
// Convert the wide character string to multibyte
533-
// for printing.
534-
CW2A printstr(ccombstr);
535-
cout << printstr << endl;
536-
}
484+
// Convert to a char* string from CStringA string
485+
// and display the result.
486+
const size_t newsizea = (origa.GetLength() + 1);
487+
char *nstringa = new char[newsizea];
488+
strcpy_s(nstringa, newsizea, origa);
489+
cout << nstringa << " (char *)" << endl;
490+
491+
// Convert to a char* string from a wide character
492+
// CStringW string. To be safe, we allocate two bytes for each
493+
// character in the original string, including the terminating
494+
// null.
495+
const size_t newsizew = (origw.GetLength() + 1)*2;
496+
char *nstringw = new char[newsizew];
497+
size_t convertedCharsw = 0;
498+
wcstombs_s(&convertedCharsw, nstringw, newsizew, origw, _TRUNCATE );
499+
cout << nstringw << " (char *)" << endl;
500+
501+
// Convert to a wchar_t* from CStringA
502+
size_t convertedCharsa = 0;
503+
wchar_t *wcstring = new wchar_t[newsizea];
504+
mbstowcs_s(&convertedCharsa, wcstring, newsizea, origa, _TRUNCATE);
505+
wcout << wcstring << _T(" (wchar_t *)") << endl;
537506

538-
// Convert to a wide character CComBSTR string from
539-
// a wide character CStringW string.
540-
CComBSTR ccombstrw(origw);
541-
// Append the type of string to it, and display the result.
507+
// Convert to a wide character wchar_t* string from
508+
// a wide character CStringW string.
509+
wchar_t *n2stringw = new wchar_t[newsizew];
510+
wcscpy_s( n2stringw, newsizew, origw );
511+
wcout << n2stringw << _T(" (wchar_t *)") << endl;
542512

543-
if (ccombstrw.Append(_T(" (CComBSTR)")) == S_OK)
544-
{
545-
CW2A printstrw(ccombstrw);
546-
wcout << printstrw << endl;
547-
}
513+
// Convert to a wide character _bstr_t string from
514+
// a multibyte CStringA string.
515+
_bstr_t bstrt(origa);
516+
bstrt += _T(" (_bstr_t)");
517+
wcout << bstrt << endl;
548518

549-
// Convert a multibyte character CStringA to a
550-
// multibyte version of a basic_string string.
551-
string basicstring(origa);
552-
basicstring += " (basic_string)";
553-
cout << basicstring << endl;
554-
555-
// Convert a wide character CStringW to a
556-
// wide character version of a basic_string
557-
// string.
558-
wstring basicstringw(origw);
559-
basicstringw += _T(" (basic_string)");
560-
wcout << basicstringw << endl;
561-
562-
// Convert a multibyte character CStringA to a
563-
// System::String.
564-
String ^systemstring = gcnew String(origa);
565-
systemstring += " (System::String)";
566-
Console::WriteLine("{0}", systemstring);
567-
delete systemstring;
568-
```
519+
// Convert to a wide character_bstr_t string from
520+
// a wide character CStringW string.
521+
bstr_t bstrtw(origw);
522+
bstrtw += " (_bstr_t)";
523+
wcout << bstrtw << endl;
569524

570-
```cpp
525+
// Convert to a wide character CComBSTR string from
526+
// a multibyte character CStringA string.
527+
CComBSTR ccombstr(origa);
528+
if (ccombstr.Append(_T(" (CComBSTR)")) == S_OK)
529+
{
530+
// Convert the wide character string to multibyte
531+
// for printing.
532+
CW2A printstr(ccombstr);
533+
cout << printstr << endl;
534+
}
535+
536+
// Convert to a wide character CComBSTR string from
537+
// a wide character CStringW string.
538+
CComBSTR ccombstrw(origw);
539+
// Append the type of string to it, and display the result.
540+
541+
if (ccombstrw.Append(_T(" (CComBSTR)")) == S_OK)
542+
{
543+
CW2A printstrw(ccombstrw);
544+
wcout << printstrw << endl;
545+
}
546+
547+
// Convert a multibyte character CStringA to a
548+
// multibyte version of a basic_string string.
549+
string basicstring(origa);
550+
basicstring += " (basic_string)";
551+
cout << basicstring << endl;
552+
553+
// Convert a wide character CStringW to a
554+
// wide character version of a basic_string
555+
// string.
556+
wstring basicstringw(origw);
557+
basicstringw += _T(" (basic_string)");
558+
wcout << basicstringw << endl;
559+
560+
// Convert a multibyte character CStringA to a
561+
// System::String.
562+
String ^systemstring = gcnew String(origa);
563+
systemstring += " (System::String)";
564+
Console::WriteLine("{0}", systemstring);
565+
delete systemstring;
566+
571567
// Convert a wide character CStringW to a
572568
// System::String.
573569
String ^systemstringw = gcnew String(origw);

0 commit comments

Comments
 (0)