Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitf2898de

Browse files
committed
Improve unconstify() documentation
Refer to expression instead of variable when appropriate.Discussion:https://www.postgresql.org/message-id/08adbe4e-38f8-2c73-55f0-591392371687%402ndquadrant.com
1 parent4beea55 commitf2898de

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

‎src/include/c.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1122,28 +1122,28 @@ typedef union PGAlignedXLogBlock
11221122
#endif
11231123

11241124
/*
1125-
* Macro that allows to cast constness away froma variable, but doesn't
1125+
* Macro that allows to cast constness away froman expression, but doesn't
11261126
* allow changing the underlying type. Enforcement of the latter
11271127
* currently only works for gcc like compilers.
11281128
*
1129-
* Please note IT IS NOT SAFE to cast constness away if thevariable will ever
1129+
* Please note IT IS NOT SAFE to cast constness away if theresult will ever
11301130
* be modified (it would be undefined behaviour). Doing so anyway can cause
11311131
* compiler misoptimizations or runtime crashes (modifying readonly memory).
1132-
* It is only safe to use when the thevariable will not be modified, but API
1132+
* It is only safe to use when the theresult will not be modified, but API
11331133
* design or language restrictions prevent you from declaring that
11341134
* (e.g. because a function returns both const and non-const variables).
11351135
*
11361136
* Note that this only works in function scope, not for global variables (it'd
11371137
* be nice, but not trivial, to improve that).
11381138
*/
11391139
#if defined(HAVE__BUILTIN_TYPES_COMPATIBLE_P)
1140-
#defineunconstify(underlying_type,var) \
1141-
(StaticAssertExpr(__builtin_types_compatible_p(__typeof(var), const underlying_type), \
1140+
#defineunconstify(underlying_type,expr) \
1141+
(StaticAssertExpr(__builtin_types_compatible_p(__typeof(expr), const underlying_type), \
11421142
"wrong cast"), \
1143-
(underlying_type) (var))
1143+
(underlying_type) (expr))
11441144
#else
1145-
#defineunconstify(underlying_type,var) \
1146-
((underlying_type) (var))
1145+
#defineunconstify(underlying_type,expr) \
1146+
((underlying_type) (expr))
11471147
#endif
11481148

11491149
/* ----------------------------------------------------------------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp