#27 Fix accidental formatting in monospaced text
Opened 4 months ago by jkangas. Modified 4 months ago
jkangas/defensive-coding-guide literal-monospace-conversion  into  master

@@ -770,7 +770,7 @@ 

  The compiler lacks knowledge of such wrappers outside the

  translation unit which defines them, which means that some

  optimizations and security checks are not performed. Adding

- `__attribute__` annotations to function

+ `+__attribute__+` annotations to function

  declarations can remedy this to some extent, but these

  annotations have to be maintained carefully for feature parity

  with the standard implementation.
@@ -788,7 +788,7 @@ 

  with `warn_unused_result` as well.

  

  * Duplicating the buffer length checks based on the

- `__builtin_object_size` GCC builtin is

+ `+__builtin_object_size+` GCC builtin is

  desirable if the wrapper processes arrays. (This

  functionality is used by the

  `-D_FORTIFY_SOURCE=2` checks to guard

@@ -375,7 +375,7 @@ 

  Storing it in a global variable is therefore incorrect.

  Particularly if you are dealing with callbacks, you may have to

  store the pointer in a thread-local variable (defined with

- `__thread`). It is, however, best to avoid the

+ `+__thread+`). It is, however, best to avoid the

  complexity of calling back into Java code.

  

  Keep in mind that C/C++ and Java are different languages,

@@ -266,8 +266,8 @@ 

  The Autoconf macro `AC_GNU_SOURCE` ensures this.

  

  * Check for the presence of the `secure_getenv`

- and `__secure_getenv` function. The Autoconf

- directive `AC_CHECK_FUNCS([__secure_getenv secure_getenv])`

+ and `+__secure_getenv+` function. The Autoconf

+ directive `+AC_CHECK_FUNCS([__secure_getenv secure_getenv])+`

  performs these checks.

  

  * Arrange for a proper definition of the
@@ -286,7 +286,7 @@ 

  unexpected way.

  

  Either the `secure_getenv` function or the

- `__secure_getenv` is available from GNU libc.

+ `+__secure_getenv+` is available from GNU libc.

  

  [[ex-Defensive_Coding-Tasks-secure_getenv]]

  .Obtaining a definition for `secure_getenv`

Some monospaced text in the guide contains double underscores, which results in unintentional italicization (e.g., under Specific Programming Tasks > Processes > Accessing Environment Variables, second bullet point). When this occurs, we can use AsciiDoc's literal monospace syntax to make sure no additional formatting is applied.

Note that some of the changes have no impact on the rendered output, but prevent spurious italicization if another double underscore is added later.