mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-06-21 19:54:51 +02:00
2000-10-30 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * glib/tmpl/limits.sgml: Added documentation for G_MAXU(INT|SHORT|LONG). * glib/tmpl/macros_misc.sgml: Added documentation for G_G(U)INT(16|32|64)_FORMAT. * glib/tmpl/types.sgml: Mention G_MAXU(INT|SHORT|LONG) in documentation for gu(int|short|long).
274 lines
6.5 KiB
Plaintext
274 lines
6.5 KiB
Plaintext
<!-- ##### SECTION Title ##### -->
|
|
Miscellaneous Macros
|
|
|
|
<!-- ##### SECTION Short_Description ##### -->
|
|
specialised macros which are not used often.
|
|
|
|
<!-- ##### SECTION Long_Description ##### -->
|
|
<para>
|
|
These macros provide more specialized features which are not needed so often
|
|
by application programmers.
|
|
</para>
|
|
|
|
<!-- ##### SECTION See_Also ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
<!-- ##### MACRO G_INLINE_FUNC ##### -->
|
|
<para>
|
|
Used to declare inline functions. If inline functions are not supported on
|
|
the particular platform, the macro evaluates to the empty string.
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_STMT_START ##### -->
|
|
<para>
|
|
Used within multi-statement macros so that they can be used in places where
|
|
only one statement is expected by the compiler.
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_STMT_END ##### -->
|
|
<para>
|
|
Used within multi-statement macros so that they can be used in places where
|
|
only one statement is expected by the compiler.
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_BEGIN_DECLS ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_END_DECLS ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_N_ELEMENTS ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@arr:
|
|
|
|
|
|
<!-- ##### MACRO G_VA_COPY ##### -->
|
|
<para>
|
|
Portable way to copy <type>va_list</type> variables.
|
|
</para>
|
|
|
|
<!-- # Unused Parameters # -->
|
|
@ap1: the <type>va_list</type> variable to place a copy of @ap2 in.
|
|
@ap2: a <type>va_list</type>.
|
|
|
|
|
|
<!-- ##### MACRO G_STRINGIFY ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
@macro_or_string:
|
|
|
|
|
|
<!-- ##### MACRO G_GNUC_EXTENSION ##### -->
|
|
<para>
|
|
Expands to "__extension__" when GNU C is used as the compiler.
|
|
This simply tells GNU C not to warn about the following non-standard code
|
|
when compiling with the -pedantic option.
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_GNUC_CONST ##### -->
|
|
<para>
|
|
Expands to the GNU C const function attribute if the compiler is GNU C.
|
|
This enables optimization of the function.
|
|
See the GNU C documentation for details.
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_GNUC_NORETURN ##### -->
|
|
<para>
|
|
Expands to the GNU C noreturn function attribute if the compiler is GNU C.
|
|
It is used for declaring functions which never return.
|
|
It enables optimization of the function, and avoids possible compiler
|
|
warnings. See the GNU C documentation for details.
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_GNUC_UNUSED ##### -->
|
|
<para>
|
|
Expands to the GNU C unused function attribute if the compiler is GNU C.
|
|
It is used for declaring functions which may never be used.
|
|
It avoids possible compiler warnings. See the GNU C documentation for details.
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_GNUC_PURE ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_GNUC_PRINTF ##### -->
|
|
<para>
|
|
Expands to the GNU C format function attribute if the compiler is GNU C.
|
|
This is used for declaring functions which take a variable number of
|
|
arguments, with the same syntax as <function>printf()</function>.
|
|
It allows the compiler to type-check the arguments passed to the function.
|
|
See the GNU C documentation for details.
|
|
</para>
|
|
|
|
@format_idx: the index of the argument corresponding to the format string.
|
|
(The arguments are numbered from 1).
|
|
@arg_idx: the index of the first of the format arguments.
|
|
|
|
|
|
<!-- ##### MACRO G_GNUC_SCANF ##### -->
|
|
<para>
|
|
Expands to the GNU C format function attribute if the compiler is GNU C.
|
|
This is used for declaring functions which take a variable number of
|
|
arguments, with the same syntax as <function>scanf()</function>.
|
|
It allows the compiler to type-check the arguments passed to the function.
|
|
See the GNU C documentation for details.
|
|
</para>
|
|
|
|
@format_idx: the index of the argument corresponding to the format string.
|
|
(The arguments are numbered from 1).
|
|
@arg_idx: the index of the first of the format arguments.
|
|
|
|
|
|
<!-- ##### MACRO G_GNUC_FORMAT ##### -->
|
|
<para>
|
|
Expands to the GNU C format_arg function attribute if the compiler is GNU C.
|
|
This is used for declaring functions which take a variable number of
|
|
parameters, like <function>printf()</function> and
|
|
<function>scanf()</function>. See the GNU C documentation for details.
|
|
|
|
FIXME: I can't find this in my GNU C documentation. Take out?
|
|
</para>
|
|
|
|
@arg_idx: the index of the argument.
|
|
|
|
|
|
<!-- ##### MACRO G_GNUC_FUNCTION ##### -->
|
|
<para>
|
|
Expands to the GNU C __FUNCTION__ variable if the compiler is GNU C,
|
|
or "" if it isn't.
|
|
The GNU C __FUNCTION__ variable contains the name of the current function.
|
|
See the GNU C documentation for details.
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_GNUC_PRETTY_FUNCTION ##### -->
|
|
<para>
|
|
Expands to the GNU C __PRETTY_FUNCTION__ variable if the compiler is GNU C,
|
|
or "" if it isn't.
|
|
The GNU C __PRETTY_FUNCTION__ variable contains the name of the current
|
|
function. For a C program this is the same as the __FUNCTION__ variable
|
|
but for C++ it also includes extra information such as the class
|
|
and function prototype. See the GNU C documentation for details.
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_STRLOC ##### -->
|
|
<para>
|
|
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_GINT16_FORMAT ##### -->
|
|
<para>
|
|
This is the platform dependent conversion specifier for scanning and
|
|
printing values of type #gint16. It is a string literal, but doesn't
|
|
include the percent-sign, such that you can add precision and length
|
|
modifiers between percent-sign and conversion specifier.
|
|
</para>
|
|
|
|
<para>
|
|
<informalexample>
|
|
<programlisting>
|
|
gint16 in;
|
|
gint32 out;
|
|
sscanf ("42", "%" G_GINT16_FORMAT, &in)
|
|
out = in * 1000;
|
|
g_print ("%" G_GINT32_FORMAT, out);
|
|
</programlisting>
|
|
</informalexample>
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_GUINT16_FORMAT ##### -->
|
|
<para>
|
|
This is the platform dependent conversion specifier for scanning and
|
|
printing values of type #guint16. See also #G_GINT16_FORMAT.
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_GINT32_FORMAT ##### -->
|
|
<para>
|
|
This is the platform dependent conversion specifier for scanning and
|
|
printing values of type #gint32. See also #G_GINT16_FORMAT.
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_GUINT32_FORMAT ##### -->
|
|
<para>
|
|
This is the platform dependent conversion specifier for scanning and
|
|
printing values of type #guint32. See also #G_GINT16_FORMAT.
|
|
</para>
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_GINT64_FORMAT ##### -->
|
|
<para>
|
|
This is the platform dependent conversion specifier for scanning and
|
|
printing values of type #gint64. See also #G_GINT16_FORMAT.
|
|
</para>
|
|
|
|
<note>
|
|
<para>
|
|
Some platforms do not support scanning and printing 64 bit integers,
|
|
even though the types are supported. On such platforms G_GINT64_FORMAT
|
|
is not defined.
|
|
</para>
|
|
</note>
|
|
|
|
|
|
|
|
<!-- ##### MACRO G_GUINT64_FORMAT ##### -->
|
|
<para>
|
|
This is the platform dependent conversion specifier for scanning and
|
|
printing values of type #guint64. See also #G_GINT16_FORMAT.
|
|
</para>
|
|
|
|
<note>
|
|
<para>
|
|
Some platforms do not support scanning and printing 64 bit integers,
|
|
even though the types are supported. On such platforms G_GUINT64_FORMAT
|
|
is not defined.
|
|
</para>
|
|
</note>
|
|
|
|
|
|
|