Merge branch 'fix-gdbus-unix-addresses-test' into 'master'
[glib.git] / glib / docs.c
blob5a786311ce7e40806c75ae7161fc232af8fdc57b
1 /*
2 * Copyright © 2011 Red Hat, Inc
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
17 * Author: Matthias Clasen
21 /* This file collects documentation for macros, typedefs and
22 * the like, which have no good home in any of the 'real' source
23 * files.
26 /* Basic types {{{1 */
28 /**
29 * SECTION:types
30 * @title: Basic Types
31 * @short_description: standard GLib types, defined for ease-of-use
32 * and portability
34 * GLib defines a number of commonly used types, which can be divided
35 * into several groups:
36 * - New types which are not part of standard C (but are defined in
37 * various C standard library header files) — #gboolean, #gssize.
38 * - Integer types which are guaranteed to be the same size across
39 * all platforms — #gint8, #guint8, #gint16, #guint16, #gint32,
40 * #guint32, #gint64, #guint64.
41 * - Types which are easier to use than their standard C counterparts -
42 * #gpointer, #gconstpointer, #guchar, #guint, #gushort, #gulong.
43 * - Types which correspond exactly to standard C types, but are
44 * included for completeness — #gchar, #gint, #gshort, #glong,
45 * #gfloat, #gdouble.
46 * - Types which correspond exactly to standard C99 types, but are available
47 * to use even if your compiler does not support C99 — #gsize, #goffset,
48 * #gintptr, #guintptr.
50 * GLib also defines macros for the limits of some of the standard
51 * integer and floating point types, as well as macros for suitable
52 * printf() formats for these types.
54 * Note that depending on the platform and build configuration, the format
55 * macros might not be compatible with the system provided printf() function,
56 * because GLib might use a different printf() implementation internally.
57 * The format macros will always work with GLib API (like g_print()), and with
58 * any C99 compatible printf() implementation.
61 /**
62 * gboolean:
64 * A standard boolean type.
65 * Variables of this type should only contain the value
66 * %TRUE or %FALSE.
69 /**
70 * gpointer:
72 * An untyped pointer.
73 * #gpointer looks better and is easier to use than void*.
76 /**
77 * gconstpointer:
79 * An untyped pointer to constant data.
80 * The data pointed to should not be changed.
82 * This is typically used in function prototypes to indicate
83 * that the data pointed to will not be altered by the function.
86 /**
87 * gchar:
89 * Corresponds to the standard C char type.
92 /**
93 * guchar:
95 * Corresponds to the standard C unsigned char type.
98 /**
99 * gint:
101 * Corresponds to the standard C int type.
102 * Values of this type can range from #G_MININT to #G_MAXINT.
106 * G_MININT:
108 * The minimum value which can be held in a #gint.
112 * G_MAXINT:
114 * The maximum value which can be held in a #gint.
118 * guint:
120 * Corresponds to the standard C unsigned int type.
121 * Values of this type can range from 0 to #G_MAXUINT.
125 * G_MAXUINT:
127 * The maximum value which can be held in a #guint.
131 * gshort:
133 * Corresponds to the standard C short type.
134 * Values of this type can range from #G_MINSHORT to #G_MAXSHORT.
138 * G_MINSHORT:
140 * The minimum value which can be held in a #gshort.
144 * G_MAXSHORT:
146 * The maximum value which can be held in a #gshort.
150 * gushort:
152 * Corresponds to the standard C unsigned short type.
153 * Values of this type can range from 0 to #G_MAXUSHORT.
157 * G_MAXUSHORT:
159 * The maximum value which can be held in a #gushort.
163 * glong:
165 * Corresponds to the standard C long type.
166 * Values of this type can range from #G_MINLONG to #G_MAXLONG.
170 * G_MINLONG:
172 * The minimum value which can be held in a #glong.
176 * G_MAXLONG:
178 * The maximum value which can be held in a #glong.
182 * gulong:
184 * Corresponds to the standard C unsigned long type.
185 * Values of this type can range from 0 to #G_MAXULONG.
189 * G_MAXULONG:
191 * The maximum value which can be held in a #gulong.
195 * gint8:
197 * A signed integer guaranteed to be 8 bits on all platforms.
198 * Values of this type can range from #G_MININT8 (= -128) to
199 * #G_MAXINT8 (= 127).
203 * G_MININT8:
205 * The minimum value which can be held in a #gint8.
207 * Since: 2.4
211 * G_MAXINT8:
213 * The maximum value which can be held in a #gint8.
215 * Since: 2.4
219 * guint8:
221 * An unsigned integer guaranteed to be 8 bits on all platforms.
222 * Values of this type can range from 0 to #G_MAXUINT8 (= 255).
226 * G_MAXUINT8:
228 * The maximum value which can be held in a #guint8.
230 * Since: 2.4
234 * gint16:
236 * A signed integer guaranteed to be 16 bits on all platforms.
237 * Values of this type can range from #G_MININT16 (= -32,768) to
238 * #G_MAXINT16 (= 32,767).
240 * To print or scan values of this type, use
241 * %G_GINT16_MODIFIER and/or %G_GINT16_FORMAT.
245 * G_MININT16:
247 * The minimum value which can be held in a #gint16.
249 * Since: 2.4
253 * G_MAXINT16:
255 * The maximum value which can be held in a #gint16.
257 * Since: 2.4
261 * G_GINT16_MODIFIER:
263 * The platform dependent length modifier for conversion specifiers
264 * for scanning and printing values of type #gint16 or #guint16. It
265 * is a string literal, but doesn't include the percent-sign, such
266 * that you can add precision and length modifiers between percent-sign
267 * and conversion specifier and append a conversion specifier.
269 * The following example prints "0x7b";
270 * |[<!-- language="C" -->
271 * gint16 value = 123;
272 * g_print ("%#" G_GINT16_MODIFIER "x", value);
273 * ]|
275 * Since: 2.4
279 * G_GINT16_FORMAT:
281 * This is the platform dependent conversion specifier for scanning and
282 * printing values of type #gint16. It is a string literal, but doesn't
283 * include the percent-sign, such that you can add precision and length
284 * modifiers between percent-sign and conversion specifier.
286 * |[<!-- language="C" -->
287 * gint16 in;
288 * gint32 out;
289 * sscanf ("42", "%" G_GINT16_FORMAT, &in)
290 * out = in * 1000;
291 * g_print ("%" G_GINT32_FORMAT, out);
292 * ]|
296 * guint16:
298 * An unsigned integer guaranteed to be 16 bits on all platforms.
299 * Values of this type can range from 0 to #G_MAXUINT16 (= 65,535).
301 * To print or scan values of this type, use
302 * %G_GINT16_MODIFIER and/or %G_GUINT16_FORMAT.
306 * G_MAXUINT16:
308 * The maximum value which can be held in a #guint16.
310 * Since: 2.4
314 * G_GUINT16_FORMAT:
316 * This is the platform dependent conversion specifier for scanning
317 * and printing values of type #guint16. See also #G_GINT16_FORMAT
321 * gint32:
323 * A signed integer guaranteed to be 32 bits on all platforms.
324 * Values of this type can range from #G_MININT32 (= -2,147,483,648)
325 * to #G_MAXINT32 (= 2,147,483,647).
327 * To print or scan values of this type, use
328 * %G_GINT32_MODIFIER and/or %G_GINT32_FORMAT.
332 * G_MININT32:
334 * The minimum value which can be held in a #gint32.
336 * Since: 2.4
340 * G_MAXINT32:
342 * The maximum value which can be held in a #gint32.
344 * Since: 2.4
348 * G_GINT32_MODIFIER:
350 * The platform dependent length modifier for conversion specifiers
351 * for scanning and printing values of type #gint32 or #guint32. It
352 * is a string literal. See also #G_GINT16_MODIFIER.
354 * Since: 2.4
358 * G_GINT32_FORMAT:
360 * This is the platform dependent conversion specifier for scanning
361 * and printing values of type #gint32. See also #G_GINT16_FORMAT.
365 * guint32:
367 * An unsigned integer guaranteed to be 32 bits on all platforms.
368 * Values of this type can range from 0 to #G_MAXUINT32 (= 4,294,967,295).
370 * To print or scan values of this type, use
371 * %G_GINT32_MODIFIER and/or %G_GUINT32_FORMAT.
375 * G_MAXUINT32:
377 * The maximum value which can be held in a #guint32.
379 * Since: 2.4
383 * G_GUINT32_FORMAT:
385 * This is the platform dependent conversion specifier for scanning
386 * and printing values of type #guint32. See also #G_GINT16_FORMAT.
390 * gint64:
392 * A signed integer guaranteed to be 64 bits on all platforms.
393 * Values of this type can range from #G_MININT64
394 * (= -9,223,372,036,854,775,808) to #G_MAXINT64
395 * (= 9,223,372,036,854,775,807).
397 * To print or scan values of this type, use
398 * %G_GINT64_MODIFIER and/or %G_GINT64_FORMAT.
402 * G_MININT64:
404 * The minimum value which can be held in a #gint64.
408 * G_MAXINT64:
410 * The maximum value which can be held in a #gint64.
414 * G_GINT64_MODIFIER:
416 * The platform dependent length modifier for conversion specifiers
417 * for scanning and printing values of type #gint64 or #guint64.
418 * It is a string literal.
420 * Some platforms do not support printing 64-bit integers, even
421 * though the types are supported. On such platforms %G_GINT64_MODIFIER
422 * is not defined.
424 * Since: 2.4
428 * G_GINT64_FORMAT:
430 * This is the platform dependent conversion specifier for scanning
431 * and printing values of type #gint64. See also #G_GINT16_FORMAT.
433 * Some platforms do not support scanning and printing 64-bit integers,
434 * even though the types are supported. On such platforms %G_GINT64_FORMAT
435 * is not defined. Note that scanf() may not support 64-bit integers, even
436 * if %G_GINT64_FORMAT is defined. Due to its weak error handling, scanf()
437 * is not recommended for parsing anyway; consider using g_ascii_strtoull()
438 * instead.
442 * guint64:
444 * An unsigned integer guaranteed to be 64-bits on all platforms.
445 * Values of this type can range from 0 to #G_MAXUINT64
446 * (= 18,446,744,073,709,551,615).
448 * To print or scan values of this type, use
449 * %G_GINT64_MODIFIER and/or %G_GUINT64_FORMAT.
453 * G_MAXUINT64:
455 * The maximum value which can be held in a #guint64.
459 * G_GUINT64_FORMAT:
461 * This is the platform dependent conversion specifier for scanning
462 * and printing values of type #guint64. See also #G_GINT16_FORMAT.
464 * Some platforms do not support scanning and printing 64-bit integers,
465 * even though the types are supported. On such platforms %G_GUINT64_FORMAT
466 * is not defined. Note that scanf() may not support 64-bit integers, even
467 * if %G_GINT64_FORMAT is defined. Due to its weak error handling, scanf()
468 * is not recommended for parsing anyway; consider using g_ascii_strtoull()
469 * instead.
473 * G_GINT64_CONSTANT:
474 * @val: a literal integer value, e.g. 0x1d636b02300a7aa7
476 * This macro is used to insert 64-bit integer literals
477 * into the source code.
481 * G_GUINT64_CONSTANT:
482 * @val: a literal integer value, e.g. 0x1d636b02300a7aa7U
484 * This macro is used to insert 64-bit unsigned integer
485 * literals into the source code.
487 * Since: 2.10
491 * gfloat:
493 * Corresponds to the standard C float type.
494 * Values of this type can range from -#G_MAXFLOAT to #G_MAXFLOAT.
498 * G_MINFLOAT:
500 * The minimum positive value which can be held in a #gfloat.
502 * If you are interested in the smallest value which can be held
503 * in a #gfloat, use -%G_MAXFLOAT.
507 * G_MAXFLOAT:
509 * The maximum value which can be held in a #gfloat.
513 * gdouble:
515 * Corresponds to the standard C double type.
516 * Values of this type can range from -#G_MAXDOUBLE to #G_MAXDOUBLE.
520 * G_MINDOUBLE:
522 * The minimum positive value which can be held in a #gdouble.
524 * If you are interested in the smallest value which can be held
525 * in a #gdouble, use -%G_MAXDOUBLE.
529 * G_MAXDOUBLE:
531 * The maximum value which can be held in a #gdouble.
535 * gsize:
537 * An unsigned integer type of the result of the sizeof operator,
538 * corresponding to the size_t type defined in C99.
539 * This type is wide enough to hold the numeric value of a pointer,
540 * so it is usually 32 bit wide on a 32-bit platform and 64 bit wide
541 * on a 64-bit platform. Values of this type can range from 0 to
542 * #G_MAXSIZE.
544 * To print or scan values of this type, use
545 * %G_GSIZE_MODIFIER and/or %G_GSIZE_FORMAT.
549 * G_MAXSIZE:
551 * The maximum value which can be held in a #gsize.
553 * Since: 2.4
557 * G_GSIZE_MODIFIER:
559 * The platform dependent length modifier for conversion specifiers
560 * for scanning and printing values of type #gsize. It
561 * is a string literal.
563 * Since: 2.6
567 * G_GSIZE_FORMAT:
569 * This is the platform dependent conversion specifier for scanning
570 * and printing values of type #gsize. See also #G_GINT16_FORMAT.
572 * Since: 2.6
576 * gssize:
578 * A signed variant of #gsize, corresponding to the
579 * ssize_t defined on most platforms.
580 * Values of this type can range from #G_MINSSIZE
581 * to #G_MAXSSIZE.
583 * To print or scan values of this type, use
584 * %G_GSSIZE_MODIFIER and/or %G_GSSIZE_FORMAT.
588 * G_MINSSIZE:
590 * The minimum value which can be held in a #gssize.
592 * Since: 2.14
596 * G_MAXSSIZE:
598 * The maximum value which can be held in a #gssize.
600 * Since: 2.14
604 * G_GSSIZE_FORMAT:
606 * This is the platform dependent conversion specifier for scanning
607 * and printing values of type #gssize. See also #G_GINT16_FORMAT.
609 * Since: 2.6
613 * G_GSSIZE_MODIFIER:
615 * The platform dependent length modifier for conversion specifiers
616 * for scanning and printing values of type #gssize. It
617 * is a string literal.
619 * Since: 2.6
623 * goffset:
625 * A signed integer type that is used for file offsets,
626 * corresponding to the POSIX type `off_t` as if compiling with
627 * `_FILE_OFFSET_BITS` set to 64. #goffset is always 64 bits wide, even on
628 * 32-bit architectures.
629 * Values of this type can range from #G_MINOFFSET to
630 * #G_MAXOFFSET.
632 * To print or scan values of this type, use
633 * %G_GOFFSET_MODIFIER and/or %G_GOFFSET_FORMAT.
635 * Since: 2.14
639 * G_MINOFFSET:
641 * The minimum value which can be held in a #goffset.
645 * G_MAXOFFSET:
647 * The maximum value which can be held in a #goffset.
651 * G_GOFFSET_MODIFIER:
653 * The platform dependent length modifier for conversion specifiers
654 * for scanning and printing values of type #goffset. It is a string
655 * literal. See also #G_GINT64_MODIFIER.
657 * Since: 2.20
661 * G_GOFFSET_FORMAT:
663 * This is the platform dependent conversion specifier for scanning
664 * and printing values of type #goffset. See also #G_GINT64_FORMAT.
666 * Since: 2.20
670 * G_GOFFSET_CONSTANT:
671 * @val: a literal integer value, e.g. 0x1d636b02300a7aa7
673 * This macro is used to insert #goffset 64-bit integer literals
674 * into the source code.
676 * See also #G_GINT64_CONSTANT.
678 * Since: 2.20
682 * gintptr:
684 * Corresponds to the C99 type intptr_t,
685 * a signed integer type that can hold any pointer.
687 * To print or scan values of this type, use
688 * %G_GINTPTR_MODIFIER and/or %G_GINTPTR_FORMAT.
690 * Since: 2.18
694 * G_GINTPTR_MODIFIER:
696 * The platform dependent length modifier for conversion specifiers
697 * for scanning and printing values of type #gintptr or #guintptr.
698 * It is a string literal.
700 * Since: 2.22
704 * G_GINTPTR_FORMAT:
706 * This is the platform dependent conversion specifier for scanning
707 * and printing values of type #gintptr.
709 * Since: 2.22
713 * guintptr:
715 * Corresponds to the C99 type uintptr_t,
716 * an unsigned integer type that can hold any pointer.
718 * To print or scan values of this type, use
719 * %G_GINTPTR_MODIFIER and/or %G_GUINTPTR_FORMAT.
721 * Since: 2.18
725 * G_GUINTPTR_FORMAT:
727 * This is the platform dependent conversion specifier
728 * for scanning and printing values of type #guintptr.
730 * Since: 2.22
733 /* Type conversion {{{1 */
736 * SECTION:type_conversion
737 * @title: Type Conversion Macros
738 * @short_description: portably storing integers in pointer variables
740 * Many times GLib, GTK+, and other libraries allow you to pass "user
741 * data" to a callback, in the form of a void pointer. From time to time
742 * you want to pass an integer instead of a pointer. You could allocate
743 * an integer, with something like:
744 * |[<!-- language="C" -->
745 * int *ip = g_new (int, 1);
746 * *ip = 42;
747 * ]|
748 * But this is inconvenient, and it's annoying to have to free the
749 * memory at some later time.
751 * Pointers are always at least 32 bits in size (on all platforms GLib
752 * intends to support). Thus you can store at least 32-bit integer values
753 * in a pointer value. Naively, you might try this, but it's incorrect:
754 * |[<!-- language="C" -->
755 * gpointer p;
756 * int i;
757 * p = (void*) 42;
758 * i = (int) p;
759 * ]|
760 * Again, that example was not correct, don't copy it.
761 * The problem is that on some systems you need to do this:
762 * |[<!-- language="C" -->
763 * gpointer p;
764 * int i;
765 * p = (void*) (long) 42;
766 * i = (int) (long) p;
767 * ]|
768 * The GLib macros GPOINTER_TO_INT(), GINT_TO_POINTER(), etc. take care
769 * to do the right thing on every platform.
771 * Warning: You may not store pointers in integers. This is not
772 * portable in any way, shape or form. These macros only allow storing
773 * integers in pointers, and only preserve 32 bits of the integer; values
774 * outside the range of a 32-bit integer will be mangled.
778 * GINT_TO_POINTER:
779 * @i: integer to stuff into a pointer
781 * Stuffs an integer into a pointer type.
783 * Remember, you may not store pointers in integers. This is not portable
784 * in any way, shape or form. These macros only allow storing integers in
785 * pointers, and only preserve 32 bits of the integer; values outside the
786 * range of a 32-bit integer will be mangled.
790 * GPOINTER_TO_INT:
791 * @p: pointer containing an integer
793 * Extracts an integer from a pointer. The integer must have
794 * been stored in the pointer with GINT_TO_POINTER().
796 * Remember, you may not store pointers in integers. This is not portable
797 * in any way, shape or form. These macros only allow storing integers in
798 * pointers, and only preserve 32 bits of the integer; values outside the
799 * range of a 32-bit integer will be mangled.
803 * GUINT_TO_POINTER:
804 * @u: unsigned integer to stuff into the pointer
806 * Stuffs an unsigned integer into a pointer type.
810 * GPOINTER_TO_UINT:
811 * @p: pointer to extract an unsigned integer from
813 * Extracts an unsigned integer from a pointer. The integer must have
814 * been stored in the pointer with GUINT_TO_POINTER().
818 * GSIZE_TO_POINTER:
819 * @s: #gsize to stuff into the pointer
821 * Stuffs a #gsize into a pointer type.
825 * GPOINTER_TO_SIZE:
826 * @p: pointer to extract a #gsize from
828 * Extracts a #gsize from a pointer. The #gsize must have
829 * been stored in the pointer with GSIZE_TO_POINTER().
832 /* Byte order {{{1 */
835 * SECTION:byte_order
836 * @title: Byte Order Macros
837 * @short_description: a portable way to convert between different byte orders
839 * These macros provide a portable way to determine the host byte order
840 * and to convert values between different byte orders.
842 * The byte order is the order in which bytes are stored to create larger
843 * data types such as the #gint and #glong values.
844 * The host byte order is the byte order used on the current machine.
846 * Some processors store the most significant bytes (i.e. the bytes that
847 * hold the largest part of the value) first. These are known as big-endian
848 * processors. Other processors (notably the x86 family) store the most
849 * significant byte last. These are known as little-endian processors.
851 * Finally, to complicate matters, some other processors store the bytes in
852 * a rather curious order known as PDP-endian. For a 4-byte word, the 3rd
853 * most significant byte is stored first, then the 4th, then the 1st and
854 * finally the 2nd.
856 * Obviously there is a problem when these different processors communicate
857 * with each other, for example over networks or by using binary file formats.
858 * This is where these macros come in. They are typically used to convert
859 * values into a byte order which has been agreed on for use when
860 * communicating between different processors. The Internet uses what is
861 * known as 'network byte order' as the standard byte order (which is in
862 * fact the big-endian byte order).
864 * Note that the byte order conversion macros may evaluate their arguments
865 * multiple times, thus you should not use them with arguments which have
866 * side-effects.
870 * G_BYTE_ORDER:
872 * The host byte order.
873 * This can be either #G_LITTLE_ENDIAN or #G_BIG_ENDIAN (support for
874 * #G_PDP_ENDIAN may be added in future.)
878 * G_LITTLE_ENDIAN:
880 * Specifies one of the possible types of byte order.
881 * See #G_BYTE_ORDER.
885 * G_BIG_ENDIAN:
887 * Specifies one of the possible types of byte order.
888 * See #G_BYTE_ORDER.
892 * G_PDP_ENDIAN:
894 * Specifies one of the possible types of byte order
895 * (currently unused). See #G_BYTE_ORDER.
899 * g_htonl:
900 * @val: a 32-bit integer value in host byte order
902 * Converts a 32-bit integer value from host to network byte order.
904 * Returns: @val converted to network byte order
908 * g_htons:
909 * @val: a 16-bit integer value in host byte order
911 * Converts a 16-bit integer value from host to network byte order.
913 * Returns: @val converted to network byte order
917 * g_ntohl:
918 * @val: a 32-bit integer value in network byte order
920 * Converts a 32-bit integer value from network to host byte order.
922 * Returns: @val converted to host byte order.
926 * g_ntohs:
927 * @val: a 16-bit integer value in network byte order
929 * Converts a 16-bit integer value from network to host byte order.
931 * Returns: @val converted to host byte order
935 * GINT_FROM_BE:
936 * @val: a #gint value in big-endian byte order
938 * Converts a #gint value from big-endian to host byte order.
940 * Returns: @val converted to host byte order
944 * GINT_FROM_LE:
945 * @val: a #gint value in little-endian byte order
947 * Converts a #gint value from little-endian to host byte order.
949 * Returns: @val converted to host byte order
953 * GINT_TO_BE:
954 * @val: a #gint value in host byte order
956 * Converts a #gint value from host byte order to big-endian.
958 * Returns: @val converted to big-endian byte order
962 * GINT_TO_LE:
963 * @val: a #gint value in host byte order
965 * Converts a #gint value from host byte order to little-endian.
967 * Returns: @val converted to little-endian byte order
971 * GUINT_FROM_BE:
972 * @val: a #guint value in big-endian byte order
974 * Converts a #guint value from big-endian to host byte order.
976 * Returns: @val converted to host byte order
980 * GUINT_FROM_LE:
981 * @val: a #guint value in little-endian byte order
983 * Converts a #guint value from little-endian to host byte order.
985 * Returns: @val converted to host byte order
989 * GUINT_TO_BE:
990 * @val: a #guint value in host byte order
992 * Converts a #guint value from host byte order to big-endian.
994 * Returns: @val converted to big-endian byte order
998 * GUINT_TO_LE:
999 * @val: a #guint value in host byte order
1001 * Converts a #guint value from host byte order to little-endian.
1003 * Returns: @val converted to little-endian byte order.
1007 * GLONG_FROM_BE:
1008 * @val: a #glong value in big-endian byte order
1010 * Converts a #glong value from big-endian to the host byte order.
1012 * Returns: @val converted to host byte order
1016 * GLONG_FROM_LE:
1017 * @val: a #glong value in little-endian byte order
1019 * Converts a #glong value from little-endian to host byte order.
1021 * Returns: @val converted to host byte order
1025 * GLONG_TO_BE:
1026 * @val: a #glong value in host byte order
1028 * Converts a #glong value from host byte order to big-endian.
1030 * Returns: @val converted to big-endian byte order
1034 * GLONG_TO_LE:
1035 * @val: a #glong value in host byte order
1037 * Converts a #glong value from host byte order to little-endian.
1039 * Returns: @val converted to little-endian
1043 * GULONG_FROM_BE:
1044 * @val: a #gulong value in big-endian byte order
1046 * Converts a #gulong value from big-endian to host byte order.
1048 * Returns: @val converted to host byte order
1052 * GULONG_FROM_LE:
1053 * @val: a #gulong value in little-endian byte order
1055 * Converts a #gulong value from little-endian to host byte order.
1057 * Returns: @val converted to host byte order
1061 * GULONG_TO_BE:
1062 * @val: a #gulong value in host byte order
1064 * Converts a #gulong value from host byte order to big-endian.
1066 * Returns: @val converted to big-endian
1070 * GULONG_TO_LE:
1071 * @val: a #gulong value in host byte order
1073 * Converts a #gulong value from host byte order to little-endian.
1075 * Returns: @val converted to little-endian
1079 * GSIZE_FROM_BE:
1080 * @val: a #gsize value in big-endian byte order
1082 * Converts a #gsize value from big-endian to the host byte order.
1084 * Returns: @val converted to host byte order
1088 * GSIZE_FROM_LE:
1089 * @val: a #gsize value in little-endian byte order
1091 * Converts a #gsize value from little-endian to host byte order.
1093 * Returns: @val converted to host byte order
1097 * GSIZE_TO_BE:
1098 * @val: a #gsize value in host byte order
1100 * Converts a #gsize value from host byte order to big-endian.
1102 * Returns: @val converted to big-endian byte order
1106 * GSIZE_TO_LE:
1107 * @val: a #gsize value in host byte order
1109 * Converts a #gsize value from host byte order to little-endian.
1111 * Returns: @val converted to little-endian
1115 * GSSIZE_FROM_BE:
1116 * @val: a #gssize value in big-endian byte order
1118 * Converts a #gssize value from big-endian to host byte order.
1120 * Returns: @val converted to host byte order
1124 * GSSIZE_FROM_LE:
1125 * @val: a #gssize value in little-endian byte order
1127 * Converts a #gssize value from little-endian to host byte order.
1129 * Returns: @val converted to host byte order
1133 * GSSIZE_TO_BE:
1134 * @val: a #gssize value in host byte order
1136 * Converts a #gssize value from host byte order to big-endian.
1138 * Returns: @val converted to big-endian
1142 * GSSIZE_TO_LE:
1143 * @val: a #gssize value in host byte order
1145 * Converts a #gssize value from host byte order to little-endian.
1147 * Returns: @val converted to little-endian
1151 * GINT16_FROM_BE:
1152 * @val: a #gint16 value in big-endian byte order
1154 * Converts a #gint16 value from big-endian to host byte order.
1156 * Returns: @val converted to host byte order
1160 * GINT16_FROM_LE:
1161 * @val: a #gint16 value in little-endian byte order
1163 * Converts a #gint16 value from little-endian to host byte order.
1165 * Returns: @val converted to host byte order
1169 * GINT16_TO_BE:
1170 * @val: a #gint16 value in host byte order
1172 * Converts a #gint16 value from host byte order to big-endian.
1174 * Returns: @val converted to big-endian
1178 * GINT16_TO_LE:
1179 * @val: a #gint16 value in host byte order
1181 * Converts a #gint16 value from host byte order to little-endian.
1183 * Returns: @val converted to little-endian
1187 * GUINT16_FROM_BE:
1188 * @val: a #guint16 value in big-endian byte order
1190 * Converts a #guint16 value from big-endian to host byte order.
1192 * Returns: @val converted to host byte order
1196 * GUINT16_FROM_LE:
1197 * @val: a #guint16 value in little-endian byte order
1199 * Converts a #guint16 value from little-endian to host byte order.
1201 * Returns: @val converted to host byte order
1205 * GUINT16_TO_BE:
1206 * @val: a #guint16 value in host byte order
1208 * Converts a #guint16 value from host byte order to big-endian.
1210 * Returns: @val converted to big-endian
1214 * GUINT16_TO_LE:
1215 * @val: a #guint16 value in host byte order
1217 * Converts a #guint16 value from host byte order to little-endian.
1219 * Returns: @val converted to little-endian
1223 * GINT32_FROM_BE:
1224 * @val: a #gint32 value in big-endian byte order
1226 * Converts a #gint32 value from big-endian to host byte order.
1228 * Returns: @val converted to host byte order
1232 * GINT32_FROM_LE:
1233 * @val: a #gint32 value in little-endian byte order
1235 * Converts a #gint32 value from little-endian to host byte order.
1237 * Returns: @val converted to host byte order
1241 * GINT32_TO_BE:
1242 * @val: a #gint32 value in host byte order
1244 * Converts a #gint32 value from host byte order to big-endian.
1246 * Returns: @val converted to big-endian
1250 * GINT32_TO_LE:
1251 * @val: a #gint32 value in host byte order
1253 * Converts a #gint32 value from host byte order to little-endian.
1255 * Returns: @val converted to little-endian
1259 * GUINT32_FROM_BE:
1260 * @val: a #guint32 value in big-endian byte order
1262 * Converts a #guint32 value from big-endian to host byte order.
1264 * Returns: @val converted to host byte order
1268 * GUINT32_FROM_LE:
1269 * @val: a #guint32 value in little-endian byte order
1271 * Converts a #guint32 value from little-endian to host byte order.
1273 * Returns: @val converted to host byte order
1277 * GUINT32_TO_BE:
1278 * @val: a #guint32 value in host byte order
1280 * Converts a #guint32 value from host byte order to big-endian.
1282 * Returns: @val converted to big-endian
1286 * GUINT32_TO_LE:
1287 * @val: a #guint32 value in host byte order
1289 * Converts a #guint32 value from host byte order to little-endian.
1291 * Returns: @val converted to little-endian
1295 * GINT64_FROM_BE:
1296 * @val: a #gint64 value in big-endian byte order
1298 * Converts a #gint64 value from big-endian to host byte order.
1300 * Returns: @val converted to host byte order
1304 * GINT64_FROM_LE:
1305 * @val: a #gint64 value in little-endian byte order
1307 * Converts a #gint64 value from little-endian to host byte order.
1309 * Returns: @val converted to host byte order
1313 * GINT64_TO_BE:
1314 * @val: a #gint64 value in host byte order
1316 * Converts a #gint64 value from host byte order to big-endian.
1318 * Returns: @val converted to big-endian
1322 * GINT64_TO_LE:
1323 * @val: a #gint64 value in host byte order
1325 * Converts a #gint64 value from host byte order to little-endian.
1327 * Returns: @val converted to little-endian
1331 * GUINT64_FROM_BE:
1332 * @val: a #guint64 value in big-endian byte order
1334 * Converts a #guint64 value from big-endian to host byte order.
1336 * Returns: @val converted to host byte order
1340 * GUINT64_FROM_LE:
1341 * @val: a #guint64 value in little-endian byte order
1343 * Converts a #guint64 value from little-endian to host byte order.
1345 * Returns: @val converted to host byte order
1349 * GUINT64_TO_BE:
1350 * @val: a #guint64 value in host byte order
1352 * Converts a #guint64 value from host byte order to big-endian.
1354 * Returns: @val converted to big-endian
1358 * GUINT64_TO_LE:
1359 * @val: a #guint64 value in host byte order
1361 * Converts a #guint64 value from host byte order to little-endian.
1363 * Returns: @val converted to little-endian
1367 * GUINT16_SWAP_BE_PDP:
1368 * @val: a #guint16 value in big-endian or pdp-endian byte order
1370 * Converts a #guint16 value between big-endian and pdp-endian byte order.
1371 * The conversion is symmetric so it can be used both ways.
1373 * Returns: @val converted to the opposite byte order
1377 * GUINT16_SWAP_LE_BE:
1378 * @val: a #guint16 value in little-endian or big-endian byte order
1380 * Converts a #guint16 value between little-endian and big-endian byte order.
1381 * The conversion is symmetric so it can be used both ways.
1383 * Returns: @val converted to the opposite byte order
1387 * GUINT16_SWAP_LE_PDP:
1388 * @val: a #guint16 value in little-endian or pdp-endian byte order
1390 * Converts a #guint16 value between little-endian and pdp-endian byte order.
1391 * The conversion is symmetric so it can be used both ways.
1393 * Returns: @val converted to the opposite byte order
1397 * GUINT32_SWAP_BE_PDP:
1398 * @val: a #guint32 value in big-endian or pdp-endian byte order
1400 * Converts a #guint32 value between big-endian and pdp-endian byte order.
1401 * The conversion is symmetric so it can be used both ways.
1403 * Returns: @val converted to the opposite byte order
1407 * GUINT32_SWAP_LE_BE:
1408 * @val: a #guint32 value in little-endian or big-endian byte order
1410 * Converts a #guint32 value between little-endian and big-endian byte order.
1411 * The conversion is symmetric so it can be used both ways.
1413 * Returns: @val converted to the opposite byte order
1417 * GUINT32_SWAP_LE_PDP:
1418 * @val: a #guint32 value in little-endian or pdp-endian byte order
1420 * Converts a #guint32 value between little-endian and pdp-endian byte order.
1421 * The conversion is symmetric so it can be used both ways.
1423 * Returns: @val converted to the opposite byte order
1427 * GUINT64_SWAP_LE_BE:
1428 * @val: a #guint64 value in little-endian or big-endian byte order
1430 * Converts a #guint64 value between little-endian and big-endian byte order.
1431 * The conversion is symmetric so it can be used both ways.
1433 * Returns: @val converted to the opposite byte order
1436 /* Bounds-checked integer arithmetic {{{1 */
1438 * SECTION:checkedmath
1439 * @title: Bounds-checking integer arithmetic
1440 * @short_description: a set of helpers for performing checked integer arithmetic
1442 * GLib offers a set of macros for doing additions and multiplications
1443 * of unsigned integers, with checks for overflows.
1445 * The helpers all have three arguments. A pointer to the destination
1446 * is always the first argument and the operands to the operation are
1447 * the other two.
1449 * Following standard GLib convention, the helpers return %TRUE in case
1450 * of success (ie: no overflow).
1452 * The helpers may be macros, normal functions or inlines. They may be
1453 * implemented with inline assembly or compiler intrinsics where
1454 * available.
1456 * Since: 2.48
1460 * g_uint_checked_add
1461 * @dest: a pointer to the #guint destination
1462 * @a: the #guint left operand
1463 * @b: the #guint right operand
1465 * Performs a checked addition of @a and @b, storing the result in
1466 * @dest.
1468 * If the operation is successful, %TRUE is returned. If the operation
1469 * overflows then the state of @dest is undefined and %FALSE is
1470 * returned.
1472 * Returns: %TRUE if there was no overflow
1473 * Since: 2.48
1477 * g_uint_checked_mul
1478 * @dest: a pointer to the #guint destination
1479 * @a: the #guint left operand
1480 * @b: the #guint right operand
1482 * Performs a checked multiplication of @a and @b, storing the result in
1483 * @dest.
1485 * If the operation is successful, %TRUE is returned. If the operation
1486 * overflows then the state of @dest is undefined and %FALSE is
1487 * returned.
1489 * Returns: %TRUE if there was no overflow
1490 * Since: 2.48
1494 * g_uint64_checked_add
1495 * @dest: a pointer to the #guint64 destination
1496 * @a: the #guint64 left operand
1497 * @b: the #guint64 right operand
1499 * Performs a checked addition of @a and @b, storing the result in
1500 * @dest.
1502 * If the operation is successful, %TRUE is returned. If the operation
1503 * overflows then the state of @dest is undefined and %FALSE is
1504 * returned.
1506 * Returns: %TRUE if there was no overflow
1507 * Since: 2.48
1511 * g_uint64_checked_mul
1512 * @dest: a pointer to the #guint64 destination
1513 * @a: the #guint64 left operand
1514 * @b: the #guint64 right operand
1516 * Performs a checked multiplication of @a and @b, storing the result in
1517 * @dest.
1519 * If the operation is successful, %TRUE is returned. If the operation
1520 * overflows then the state of @dest is undefined and %FALSE is
1521 * returned.
1523 * Returns: %TRUE if there was no overflow
1524 * Since: 2.48
1528 * g_size_checked_add
1529 * @dest: a pointer to the #gsize destination
1530 * @a: the #gsize left operand
1531 * @b: the #gsize right operand
1533 * Performs a checked addition of @a and @b, storing the result in
1534 * @dest.
1536 * If the operation is successful, %TRUE is returned. If the operation
1537 * overflows then the state of @dest is undefined and %FALSE is
1538 * returned.
1540 * Returns: %TRUE if there was no overflow
1541 * Since: 2.48
1545 * g_size_checked_mul
1546 * @dest: a pointer to the #gsize destination
1547 * @a: the #gsize left operand
1548 * @b: the #gsize right operand
1550 * Performs a checked multiplication of @a and @b, storing the result in
1551 * @dest.
1553 * If the operation is successful, %TRUE is returned. If the operation
1554 * overflows then the state of @dest is undefined and %FALSE is
1555 * returned.
1557 * Returns: %TRUE if there was no overflow
1558 * Since: 2.48
1560 /* Numerical Definitions {{{1 */
1563 * SECTION:numerical
1564 * @title: Numerical Definitions
1565 * @short_description: mathematical constants, and floating point decomposition
1567 * GLib offers mathematical constants such as #G_PI for the value of pi;
1568 * many platforms have these in the C library, but some don't, the GLib
1569 * versions always exist.
1571 * The #GFloatIEEE754 and #GDoubleIEEE754 unions are used to access the
1572 * sign, mantissa and exponent of IEEE floats and doubles. These unions are
1573 * defined as appropriate for a given platform. IEEE floats and doubles are
1574 * supported (used for storage) by at least Intel, PPC and Sparc. See
1575 * [IEEE 754-2008](http://en.wikipedia.org/wiki/IEEE_float)
1576 * for more information about IEEE number formats.
1580 * G_IEEE754_FLOAT_BIAS:
1582 * The bias by which exponents in single-precision floats are offset.
1586 * G_IEEE754_DOUBLE_BIAS:
1588 * The bias by which exponents in double-precision floats are offset.
1592 * GFloatIEEE754:
1593 * @v_float: the double value
1595 * The #GFloatIEEE754 and #GDoubleIEEE754 unions are used to access the sign,
1596 * mantissa and exponent of IEEE floats and doubles. These unions are defined
1597 * as appropriate for a given platform. IEEE floats and doubles are supported
1598 * (used for storage) by at least Intel, PPC and Sparc.
1602 * GDoubleIEEE754:
1603 * @v_double: the double value
1605 * The #GFloatIEEE754 and #GDoubleIEEE754 unions are used to access the sign,
1606 * mantissa and exponent of IEEE floats and doubles. These unions are defined
1607 * as appropriate for a given platform. IEEE floats and doubles are supported
1608 * (used for storage) by at least Intel, PPC and Sparc.
1612 * G_E:
1614 * The base of natural logarithms.
1618 * G_LN2:
1620 * The natural logarithm of 2.
1624 * G_LN10:
1626 * The natural logarithm of 10.
1630 * G_PI:
1632 * The value of pi (ratio of circle's circumference to its diameter).
1636 * G_PI_2:
1638 * Pi divided by 2.
1642 * G_PI_4:
1644 * Pi divided by 4.
1648 * G_SQRT2:
1650 * The square root of two.
1654 * G_LOG_2_BASE_10:
1656 * Multiplying the base 2 exponent by this number yields the base 10 exponent.
1659 /* Macros {{{1 */
1662 * SECTION:macros
1663 * @title: Standard Macros
1664 * @short_description: commonly-used macros
1666 * These macros provide a few commonly-used features.
1670 * G_OS_WIN32:
1672 * This macro is defined only on Windows. So you can bracket
1673 * Windows-specific code in "\#ifdef G_OS_WIN32".
1677 * G_OS_UNIX:
1679 * This macro is defined only on UNIX. So you can bracket
1680 * UNIX-specific code in "\#ifdef G_OS_UNIX".
1684 * G_DIR_SEPARATOR:
1686 * The directory separator character.
1687 * This is '/' on UNIX machines and '\' under Windows.
1691 * G_DIR_SEPARATOR_S:
1693 * The directory separator as a string.
1694 * This is "/" on UNIX machines and "\" under Windows.
1698 * G_IS_DIR_SEPARATOR:
1699 * @c: a character
1701 * Checks whether a character is a directory
1702 * separator. It returns %TRUE for '/' on UNIX
1703 * machines and for '\' or '/' under Windows.
1705 * Since: 2.6
1709 * G_SEARCHPATH_SEPARATOR:
1711 * The search path separator character.
1712 * This is ':' on UNIX machines and ';' under Windows.
1716 * G_SEARCHPATH_SEPARATOR_S:
1718 * The search path separator as a string.
1719 * This is ":" on UNIX machines and ";" under Windows.
1723 * TRUE:
1725 * Defines the %TRUE value for the #gboolean type.
1729 * FALSE:
1731 * Defines the %FALSE value for the #gboolean type.
1735 * NULL:
1737 * Defines the standard %NULL pointer.
1741 * MIN:
1742 * @a: a numeric value
1743 * @b: a numeric value
1745 * Calculates the minimum of @a and @b.
1747 * Returns: the minimum of @a and @b.
1751 * MAX:
1752 * @a: a numeric value
1753 * @b: a numeric value
1755 * Calculates the maximum of @a and @b.
1757 * Returns: the maximum of @a and @b.
1761 * ABS:
1762 * @a: a numeric value
1764 * Calculates the absolute value of @a.
1765 * The absolute value is simply the number with any negative sign taken away.
1767 * For example,
1768 * - ABS(-10) is 10.
1769 * - ABS(10) is also 10.
1771 * Returns: the absolute value of @a.
1775 * CLAMP:
1776 * @x: the value to clamp
1777 * @low: the minimum value allowed
1778 * @high: the maximum value allowed
1780 * Ensures that @x is between the limits set by @low and @high. If @low is
1781 * greater than @high the result is undefined.
1783 * For example,
1784 * - CLAMP(5, 10, 15) is 10.
1785 * - CLAMP(15, 5, 10) is 10.
1786 * - CLAMP(20, 15, 25) is 20.
1788 * Returns: the value of @x clamped to the range between @low and @high
1792 * G_APPROX_VALUE:
1793 * @a: a numeric value
1794 * @b: a numeric value
1795 * @epsilon: a numeric value that expresses the tolerance between @a and @b
1797 * Evaluates to a truth value if the absolute difference between @a and @b is
1798 * smaller than @epsilon, and to a false value otherwise.
1800 * For example,
1801 * - `G_APPROX_VALUE (5, 6, 2)` evaluates to true
1802 * - `G_APPROX_VALUE (3.14, 3.15, 0.001)` evaluates to false
1803 * - `G_APPROX_VALUE (n, 0.f, FLT_EPSILON)` evaluates to true if `n` is within
1804 * the single precision floating point epsilon from zero
1806 * Returns: %TRUE if the two values are within the desired range
1808 * Since: 2.58
1812 * G_STRUCT_MEMBER:
1813 * @member_type: the type of the struct field
1814 * @struct_p: a pointer to a struct
1815 * @struct_offset: the offset of the field from the start of the struct,
1816 * in bytes
1818 * Returns a member of a structure at a given offset, using the given type.
1820 * Returns: the struct member
1824 * G_STRUCT_MEMBER_P:
1825 * @struct_p: a pointer to a struct
1826 * @struct_offset: the offset from the start of the struct, in bytes
1828 * Returns an untyped pointer to a given offset of a struct.
1830 * Returns: an untyped pointer to @struct_p plus @struct_offset bytes
1834 * G_STRUCT_OFFSET:
1835 * @struct_type: a structure type, e.g. #GtkWidget
1836 * @member: a field in the structure, e.g. @window
1838 * Returns the offset, in bytes, of a member of a struct.
1840 * Returns: the offset of @member from the start of @struct_type
1844 * G_CONST_RETURN:
1846 * If %G_DISABLE_CONST_RETURNS is defined, this macro expands
1847 * to nothing. By default, the macro expands to const. The macro
1848 * can be used in place of const for functions that return a value
1849 * that should not be modified. The purpose of this macro is to allow
1850 * us to turn on const for returned constant strings by default, while
1851 * allowing programmers who find that annoying to turn it off. This macro
1852 * should only be used for return values and for "out" parameters, it
1853 * doesn't make sense for "in" parameters.
1855 * Deprecated: 2.30: API providers should replace all existing uses with
1856 * const and API consumers should adjust their code accordingly
1860 * G_N_ELEMENTS:
1861 * @arr: the array
1863 * Determines the number of elements in an array. The array must be
1864 * declared so the compiler knows its size at compile-time; this
1865 * macro will not work on an array allocated on the heap, only static
1866 * arrays or arrays on the stack.
1869 /* Miscellaneous Macros {{{1 */
1872 * SECTION:macros_misc
1873 * @title: Miscellaneous Macros
1874 * @short_description: specialized macros which are not used often
1876 * These macros provide more specialized features which are not
1877 * needed so often by application programmers.
1881 * G_INLINE_FUNC:
1883 * This macro used to be used to conditionally define inline functions
1884 * in a compatible way before this feature was supported in all
1885 * compilers. These days, GLib requires inlining support from the
1886 * compiler, so your GLib-using programs can safely assume that the
1887 * "inline" keywork works properly.
1889 * Never use this macro anymore. Just say "static inline".
1891 * Deprecated: 2.48: Use "static inline" instead
1895 * G_STMT_START:
1897 * Used within multi-statement macros so that they can be used in places
1898 * where only one statement is expected by the compiler.
1902 * G_STMT_END:
1904 * Used within multi-statement macros so that they can be used in places
1905 * where only one statement is expected by the compiler.
1909 * G_BEGIN_DECLS:
1911 * Used (along with #G_END_DECLS) to bracket header files. If the
1912 * compiler in use is a C++ compiler, adds extern "C"
1913 * around the header.
1917 * G_END_DECLS:
1919 * Used (along with #G_BEGIN_DECLS) to bracket header files. If the
1920 * compiler in use is a C++ compiler, adds extern "C"
1921 * around the header.
1925 * G_VA_COPY:
1926 * @ap1: the va_list variable to place a copy of @ap2 in
1927 * @ap2: a va_list
1929 * Portable way to copy va_list variables.
1931 * In order to use this function, you must include string.h yourself,
1932 * because this macro may use memmove() and GLib does not include
1933 * string.h for you.
1937 * G_STRINGIFY:
1938 * @macro_or_string: a macro or a string
1940 * Accepts a macro or a string and converts it into a string after
1941 * preprocessor argument expansion. For example, the following code:
1943 * |[<!-- language="C" -->
1944 * #define AGE 27
1945 * const gchar *greeting = G_STRINGIFY (AGE) " today!";
1946 * ]|
1948 * is transformed by the preprocessor into (code equivalent to):
1950 * |[<!-- language="C" -->
1951 * const gchar *greeting = "27 today!";
1952 * ]|
1956 * G_PASTE:
1957 * @identifier1: an identifier
1958 * @identifier2: an identifier
1960 * Yields a new preprocessor pasted identifier
1961 * @identifier1identifier2 from its expanded
1962 * arguments @identifier1 and @identifier2. For example,
1963 * the following code:
1964 * |[<!-- language="C" -->
1965 * #define GET(traveller,method) G_PASTE(traveller_get_, method) (traveller)
1966 * const gchar *name = GET (traveller, name);
1967 * const gchar *quest = GET (traveller, quest);
1968 * GdkColor *favourite = GET (traveller, favourite_colour);
1969 * ]|
1971 * is transformed by the preprocessor into:
1972 * |[<!-- language="C" -->
1973 * const gchar *name = traveller_get_name (traveller);
1974 * const gchar *quest = traveller_get_quest (traveller);
1975 * GdkColor *favourite = traveller_get_favourite_colour (traveller);
1976 * ]|
1978 * Since: 2.20
1982 * G_STATIC_ASSERT:
1983 * @expr: a constant expression
1985 * The G_STATIC_ASSERT() macro lets the programmer check
1986 * a condition at compile time, the condition needs to
1987 * be compile time computable. The macro can be used in
1988 * any place where a typedef is valid.
1990 * A typedef is generally allowed in exactly the same places that
1991 * a variable declaration is allowed. For this reason, you should
1992 * not use G_STATIC_ASSERT() in the middle of blocks of code.
1994 * The macro should only be used once per source code line.
1996 * Since: 2.20
2000 * G_STATIC_ASSERT_EXPR:
2001 * @expr: a constant expression
2003 * The G_STATIC_ASSERT_EXPR() macro lets the programmer check
2004 * a condition at compile time. The condition needs to be
2005 * compile time computable.
2007 * Unlike G_STATIC_ASSERT(), this macro evaluates to an expression
2008 * and, as such, can be used in the middle of other expressions.
2009 * Its value should be ignored. This can be accomplished by placing
2010 * it as the first argument of a comma expression.
2012 * |[<!-- language="C" -->
2013 * #define ADD_ONE_TO_INT(x) \
2014 * (G_STATIC_ASSERT_EXPR(sizeof (x) == sizeof (int)), ((x) + 1))
2015 * ]|
2017 * Since: 2.30
2021 * G_GNUC_EXTENSION:
2023 * Expands to __extension__ when gcc is used as the compiler. This simply
2024 * tells gcc not to warn about the following non-standard code when compiling
2025 * with the `-pedantic` option.
2029 * G_GNUC_CHECK_VERSION:
2030 * @major: major version to check against
2031 * @minor: minor version to check against
2033 * Expands to a a check for a compiler with __GNUC__ defined and a version
2034 * greater than or equal to the major and minor numbers provided. For example,
2035 * the following would only match on compilers such as GCC 4.8 or newer.
2037 * |[<!-- language="C" -->
2038 * #if G_GNUC_CHECK_VERSION(4, 8)
2039 * #endif
2040 * ]|
2042 * Since: 2.42
2046 * G_GNUC_CONST:
2048 * Expands to the GNU C const function attribute if the compiler is gcc.
2049 * Declaring a function as const enables better optimization of calls to
2050 * the function. A const function doesn't examine any values except its
2051 * parameters, and has no effects except its return value.
2053 * Place the attribute after the declaration, just before the semicolon.
2055 * See the GNU C documentation for more details.
2057 * A function that has pointer arguments and examines the data pointed to
2058 * must not be declared const. Likewise, a function that calls a non-const
2059 * function usually must not be const. It doesn't make sense for a const
2060 * function to return void.
2064 * G_GNUC_PURE:
2066 * Expands to the GNU C pure function attribute if the compiler is gcc.
2067 * Declaring a function as pure enables better optimization of calls to
2068 * the function. A pure function has no effects except its return value
2069 * and the return value depends only on the parameters and/or global
2070 * variables.
2072 * Place the attribute after the declaration, just before the semicolon.
2074 * See the GNU C documentation for more details.
2078 * G_GNUC_NO_INLINE:
2080 * Expands to the GNU C `noinline` function attribute if the compiler is gcc.
2081 * If the compiler is not gcc, this macro expands to nothing.
2083 * Declaring a function as `noinline` prevents the function from being
2084 * considered for inlining.
2086 * The attribute may be placed before the declaration, right before the
2087 * `static` keyword.
2089 * See the
2090 * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noinline-function-attribute)
2091 * for more details.
2093 * Since: 2.58
2097 * G_GNUC_MALLOC:
2099 * Expands to the GNU C malloc function attribute if the compiler is gcc.
2100 * Declaring a function as malloc enables better optimization of the function.
2101 * A function can have the malloc attribute if it returns a pointer which is
2102 * guaranteed to not alias with any other pointer when the function returns
2103 * (in practice, this means newly allocated memory).
2105 * Place the attribute after the declaration, just before the semicolon.
2107 * See the GNU C documentation for more details.
2109 * Since: 2.6
2113 * G_GNUC_ALLOC_SIZE:
2114 * @x: the index of the argument specifying the allocation size
2116 * Expands to the GNU C alloc_size function attribute if the compiler
2117 * is a new enough gcc. This attribute tells the compiler that the
2118 * function returns a pointer to memory of a size that is specified
2119 * by the @xth function parameter.
2121 * Place the attribute after the function declaration, just before the
2122 * semicolon.
2124 * See the GNU C documentation for more details.
2126 * Since: 2.18
2130 * G_GNUC_ALLOC_SIZE2:
2131 * @x: the index of the argument specifying one factor of the allocation size
2132 * @y: the index of the argument specifying the second factor of the allocation size
2134 * Expands to the GNU C alloc_size function attribute if the compiler is a
2135 * new enough gcc. This attribute tells the compiler that the function returns
2136 * a pointer to memory of a size that is specified by the product of two
2137 * function parameters.
2139 * Place the attribute after the function declaration, just before the
2140 * semicolon.
2142 * See the GNU C documentation for more details.
2144 * Since: 2.18
2148 * G_GNUC_DEPRECATED:
2150 * Expands to the GNU C deprecated attribute if the compiler is gcc.
2151 * It can be used to mark typedefs, variables and functions as deprecated.
2152 * When called with the `-Wdeprecated-declarations` option,
2153 * gcc will generate warnings when deprecated interfaces are used.
2155 * Place the attribute after the declaration, just before the semicolon.
2157 * See the GNU C documentation for more details.
2159 * Since: 2.2
2163 * G_GNUC_DEPRECATED_FOR:
2164 * @f: the intended replacement for the deprecated symbol,
2165 * such as the name of a function
2167 * Like %G_GNUC_DEPRECATED, but names the intended replacement for the
2168 * deprecated symbol if the version of gcc in use is new enough to support
2169 * custom deprecation messages.
2171 * Place the attribute after the declaration, just before the semicolon.
2173 * See the GNU C documentation for more details.
2175 * Note that if @f is a macro, it will be expanded in the warning message.
2176 * You can enclose it in quotes to prevent this. (The quotes will show up
2177 * in the warning, but it's better than showing the macro expansion.)
2179 * Since: 2.26
2183 * G_GNUC_BEGIN_IGNORE_DEPRECATIONS:
2185 * Tells gcc (if it is a new enough version) to temporarily stop emitting
2186 * warnings when functions marked with %G_GNUC_DEPRECATED or
2187 * %G_GNUC_DEPRECATED_FOR are called. This is useful for when you have
2188 * one deprecated function calling another one, or when you still have
2189 * regression tests for deprecated functions.
2191 * Use %G_GNUC_END_IGNORE_DEPRECATIONS to begin warning again. (If you
2192 * are not compiling with `-Wdeprecated-declarations` then neither macro
2193 * has any effect.)
2195 * This macro can be used either inside or outside of a function body,
2196 * but must appear on a line by itself.
2198 * Since: 2.32
2202 * G_GNUC_END_IGNORE_DEPRECATIONS:
2204 * Undoes the effect of %G_GNUC_BEGIN_IGNORE_DEPRECATIONS, telling
2205 * gcc to begin outputting warnings again (assuming those warnings
2206 * had been enabled to begin with).
2208 * This macro can be used either inside or outside of a function body,
2209 * but must appear on a line by itself.
2211 * Since: 2.32
2215 * G_DEPRECATED:
2217 * This macro is similar to %G_GNUC_DEPRECATED, and can be used to mark
2218 * functions declarations as deprecated. Unlike %G_GNUC_DEPRECATED, it is
2219 * meant to be portable across different compilers and must be placed
2220 * before the function declaration.
2222 * Since: 2.32
2226 * G_DEPRECATED_FOR:
2227 * @f: the name of the function that this function was deprecated for
2229 * This macro is similar to %G_GNUC_DEPRECATED_FOR, and can be used to mark
2230 * functions declarations as deprecated. Unlike %G_GNUC_DEPRECATED_FOR, it
2231 * is meant to be portable across different compilers and must be placed
2232 * before the function declaration.
2234 * Since: 2.32
2238 * G_UNAVAILABLE:
2239 * @maj: the major version that introduced the symbol
2240 * @min: the minor version that introduced the symbol
2242 * This macro can be used to mark a function declaration as unavailable.
2243 * It must be placed before the function declaration. Use of a function
2244 * that has been annotated with this macros will produce a compiler warning.
2246 * Since: 2.32
2250 * GLIB_DISABLE_DEPRECATION_WARNINGS:
2252 * A macro that should be defined before including the glib.h header.
2253 * If it is defined, no compiler warnings will be produced for uses
2254 * of deprecated GLib APIs.
2258 * G_GNUC_NORETURN:
2260 * Expands to the GNU C noreturn function attribute if the compiler is gcc.
2261 * It is used for declaring functions which never return. It enables
2262 * optimization of the function, and avoids possible compiler warnings.
2264 * Place the attribute after the declaration, just before the semicolon.
2266 * See the GNU C documentation for more details.
2270 * G_GNUC_UNUSED:
2272 * Expands to the GNU C unused function attribute if the compiler is gcc.
2273 * It is used for declaring functions and arguments which may never be used.
2274 * It avoids possible compiler warnings.
2276 * For functions, place the attribute after the declaration, just before the
2277 * semicolon. For arguments, place the attribute at the beginning of the
2278 * argument declaration.
2280 * |[<!-- language="C" -->
2281 * void my_unused_function (G_GNUC_UNUSED gint unused_argument,
2282 * gint other_argument) G_GNUC_UNUSED;
2283 * ]|
2285 * See the GNU C documentation for more details.
2289 * G_GNUC_PRINTF:
2290 * @format_idx: the index of the argument corresponding to the
2291 * format string (the arguments are numbered from 1)
2292 * @arg_idx: the index of the first of the format arguments, or 0 if
2293 * there are no format arguments
2295 * Expands to the GNU C format function attribute if the compiler is gcc.
2296 * This is used for declaring functions which take a variable number of
2297 * arguments, with the same syntax as printf(). It allows the compiler
2298 * to type-check the arguments passed to the function.
2300 * Place the attribute after the function declaration, just before the
2301 * semicolon.
2303 * See the
2304 * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-3288)
2305 * for more details.
2307 * |[<!-- language="C" -->
2308 * gint g_snprintf (gchar *string,
2309 * gulong n,
2310 * gchar const *format,
2311 * ...) G_GNUC_PRINTF (3, 4);
2312 * ]|
2316 * G_GNUC_SCANF:
2317 * @format_idx: the index of the argument corresponding to
2318 * the format string (the arguments are numbered from 1)
2319 * @arg_idx: the index of the first of the format arguments, or 0 if
2320 * there are no format arguments
2322 * Expands to the GNU C format function attribute if the compiler is gcc.
2323 * This is used for declaring functions which take a variable number of
2324 * arguments, with the same syntax as scanf(). It allows the compiler
2325 * to type-check the arguments passed to the function.
2327 * See the
2328 * [GNU C documentation](https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-Wformat-3288)
2329 * for details.
2333 * G_GNUC_FORMAT:
2334 * @arg_idx: the index of the argument
2336 * Expands to the GNU C format_arg function attribute if the compiler
2337 * is gcc. This function attribute specifies that a function takes a
2338 * format string for a printf(), scanf(), strftime() or strfmon() style
2339 * function and modifies it, so that the result can be passed to a printf(),
2340 * scanf(), strftime() or strfmon() style function (with the remaining
2341 * arguments to the format function the same as they would have been
2342 * for the unmodified string).
2344 * Place the attribute after the function declaration, just before the
2345 * semicolon.
2347 * See the GNU C documentation for more details.
2349 * |[<!-- language="C" -->
2350 * gchar *g_dgettext (gchar *domain_name, gchar *msgid) G_GNUC_FORMAT (2);
2351 * ]|
2355 * G_GNUC_NULL_TERMINATED:
2357 * Expands to the GNU C sentinel function attribute if the compiler is gcc.
2358 * This function attribute only applies to variadic functions and instructs
2359 * the compiler to check that the argument list is terminated with an
2360 * explicit %NULL.
2362 * Place the attribute after the declaration, just before the semicolon.
2364 * See the GNU C documentation for more details.
2366 * Since: 2.8
2370 * G_GNUC_WARN_UNUSED_RESULT:
2372 * Expands to the GNU C warn_unused_result function attribute if the compiler
2373 * is gcc. This function attribute makes the compiler emit a warning if the
2374 * result of a function call is ignored.
2376 * Place the attribute after the declaration, just before the semicolon.
2378 * See the GNU C documentation for more details.
2380 * Since: 2.10
2384 * G_GNUC_FUNCTION:
2386 * Expands to "" on all modern compilers, and to __FUNCTION__ on gcc
2387 * version 2.x. Don't use it.
2389 * Deprecated: 2.16: Use G_STRFUNC() instead
2393 * G_GNUC_PRETTY_FUNCTION:
2395 * Expands to "" on all modern compilers, and to __PRETTY_FUNCTION__
2396 * on gcc version 2.x. Don't use it.
2398 * Deprecated: 2.16: Use G_STRFUNC() instead
2402 * G_GNUC_NO_INSTRUMENT:
2404 * Expands to the GNU C no_instrument_function function attribute if the
2405 * compiler is gcc. Functions with this attribute will not be instrumented
2406 * for profiling, when the compiler is called with the
2407 * `-finstrument-functions` option.
2409 * Place the attribute after the declaration, just before the semicolon.
2411 * See the GNU C documentation for more details.
2415 * G_GNUC_INTERNAL:
2417 * This attribute can be used for marking library functions as being used
2418 * internally to the library only, which may allow the compiler to handle
2419 * function calls more efficiently. Note that static functions do not need
2420 * to be marked as internal in this way. See the GNU C documentation for
2421 * details.
2423 * When using a compiler that supports the GNU C hidden visibility attribute,
2424 * this macro expands to __attribute__((visibility("hidden"))).
2425 * When using the Sun Studio compiler, it expands to __hidden.
2427 * Note that for portability, the attribute should be placed before the
2428 * function declaration. While GCC allows the macro after the declaration,
2429 * Sun Studio does not.
2431 * |[<!-- language="C" -->
2432 * G_GNUC_INTERNAL
2433 * void _g_log_fallback_handler (const gchar *log_domain,
2434 * GLogLevelFlags log_level,
2435 * const gchar *message,
2436 * gpointer unused_data);
2437 * ]|
2439 * Since: 2.6
2443 * G_GNUC_MAY_ALIAS:
2445 * Expands to the GNU C may_alias type attribute if the compiler is gcc.
2446 * Types with this attribute will not be subjected to type-based alias
2447 * analysis, but are assumed to alias with any other type, just like char.
2449 * See the GNU C documentation for details.
2451 * Since: 2.14
2455 * G_LIKELY:
2456 * @expr: the expression
2458 * Hints the compiler that the expression is likely to evaluate to
2459 * a true value. The compiler may use this information for optimizations.
2461 * |[<!-- language="C" -->
2462 * if (G_LIKELY (random () != 1))
2463 * g_print ("not one");
2464 * ]|
2466 * Returns: the value of @expr
2468 * Since: 2.2
2472 * G_UNLIKELY:
2473 * @expr: the expression
2475 * Hints the compiler that the expression is unlikely to evaluate to
2476 * a true value. The compiler may use this information for optimizations.
2478 * |[<!-- language="C" -->
2479 * if (G_UNLIKELY (random () == 1))
2480 * g_print ("a random one");
2481 * ]|
2483 * Returns: the value of @expr
2485 * Since: 2.2
2489 * G_STRLOC:
2491 * Expands to a string identifying the current code position.
2495 * G_STRFUNC:
2497 * Expands to a string identifying the current function.
2499 * Since: 2.4
2503 * G_HAVE_GNUC_VISIBILITY:
2505 * Defined to 1 if gcc-style visibility handling is supported.
2508 /* g_auto(), g_autoptr() and helpers {{{1 */
2511 * g_auto:
2512 * @TypeName: a supported variable type
2514 * Helper to declare a variable with automatic cleanup.
2516 * The variable is cleaned up in a way appropriate to its type when the
2517 * variable goes out of scope. The type must support this.
2519 * This feature is only supported on GCC and clang. This macro is not
2520 * defined on other compilers and should not be used in programs that
2521 * are intended to be portable to those compilers.
2523 * This is meant to be used with stack-allocated structures and
2524 * non-pointer types. For the (more commonly used) pointer version, see
2525 * g_autoptr().
2527 * This macro can be used to avoid having to do explicit cleanups of
2528 * local variables when exiting functions. It often vastly simplifies
2529 * handling of error conditions, removing the need for various tricks
2530 * such as 'goto out' or repeating of cleanup code. It is also helpful
2531 * for non-error cases.
2533 * Consider the following example:
2535 * |[
2536 * GVariant *
2537 * my_func(void)
2539 * g_auto(GQueue) queue = G_QUEUE_INIT;
2540 * g_auto(GVariantBuilder) builder;
2541 * g_auto(GStrv) strv;
2543 * g_variant_builder_init (&builder, G_VARIANT_TYPE_VARDICT);
2544 * strv = g_strsplit("a:b:c", ":", -1);
2546 * ...
2548 * if (error_condition)
2549 * return NULL;
2551 * ...
2553 * return g_variant_builder_end (&builder);
2555 * ]|
2557 * You must initialize the variable in some way -- either by use of an
2558 * initialiser or by ensuring that an _init function will be called on
2559 * it unconditionally before it goes out of scope.
2561 * Since: 2.44
2565 * g_autoptr:
2566 * @TypeName: a supported variable type
2568 * Helper to declare a pointer variable with automatic cleanup.
2570 * The variable is cleaned up in a way appropriate to its type when the
2571 * variable goes out of scope. The type must support this.
2573 * This feature is only supported on GCC and clang. This macro is not
2574 * defined on other compilers and should not be used in programs that
2575 * are intended to be portable to those compilers.
2577 * This is meant to be used to declare pointers to types with cleanup
2578 * functions. The type of the variable is a pointer to @TypeName. You
2579 * must not add your own '*'.
2581 * This macro can be used to avoid having to do explicit cleanups of
2582 * local variables when exiting functions. It often vastly simplifies
2583 * handling of error conditions, removing the need for various tricks
2584 * such as 'goto out' or repeating of cleanup code. It is also helpful
2585 * for non-error cases.
2587 * Consider the following example:
2589 * |[
2590 * gboolean
2591 * check_exists(GVariant *dict)
2593 * g_autoptr(GVariant) dirname, basename = NULL;
2594 * g_autofree gchar *path = NULL;
2596 * dirname = g_variant_lookup_value (dict, "dirname", G_VARIANT_TYPE_STRING);
2598 * if (dirname == NULL)
2599 * return FALSE;
2601 * basename = g_variant_lookup_value (dict, "basename", G_VARIANT_TYPE_STRING);
2603 * if (basename == NULL)
2604 * return FALSE;
2606 * path = g_build_filename (g_variant_get_string (dirname, NULL),
2607 * g_variant_get_string (basename, NULL),
2608 * NULL);
2610 * return g_access (path, R_OK) == 0;
2612 * ]|
2614 * You must initialise the variable in some way -- either by use of an
2615 * initialiser or by ensuring that it is assigned to unconditionally
2616 * before it goes out of scope.
2618 * See also g_auto(), g_autofree() and g_steal_pointer().
2620 * Since: 2.44
2624 * g_autofree:
2626 * Macro to add an attribute to pointer variable to ensure automatic
2627 * cleanup using g_free().
2629 * This macro differs from g_autoptr() in that it is an attribute supplied
2630 * before the type name, rather than wrapping the type definition. Instead
2631 * of using a type-specific lookup, this macro always calls g_free() directly.
2633 * This means it's useful for any type that is returned from
2634 * g_malloc().
2636 * Otherwise, this macro has similar constraints as g_autoptr() - only
2637 * supported on GCC and clang, the variable must be initialized, etc.
2639 * |[
2640 * gboolean
2641 * operate_on_malloc_buf (void)
2643 * g_autofree guint8* membuf = NULL;
2645 * membuf = g_malloc (8192);
2647 * // Some computation on membuf
2649 * // membuf will be automatically freed here
2650 * return TRUE;
2652 * ]|
2654 * Since: 2.44
2658 * g_autolist:
2659 * @TypeName: a supported variable type
2661 * Helper to declare a list variable with automatic deep cleanup.
2663 * The list is deeply freed, in a way appropriate to the specified type, when the
2664 * variable goes out of scope. The type must support this.
2666 * This feature is only supported on GCC and clang. This macro is not
2667 * defined on other compilers and should not be used in programs that
2668 * are intended to be portable to those compilers.
2670 * This is meant to be used to declare lists of a type with a cleanup
2671 * function. The type of the variable is a GList *. You
2672 * must not add your own '*'.
2674 * This macro can be used to avoid having to do explicit cleanups of
2675 * local variables when exiting functions. It often vastly simplifies
2676 * handling of error conditions, removing the need for various tricks
2677 * such as 'goto out' or repeating of cleanup code. It is also helpful
2678 * for non-error cases.
2680 * See also g_autoslist(), g_autoptr() and g_steal_pointer().
2682 * Since: 2.56
2686 * g_autoslist:
2687 * @TypeName: a supported variable type
2689 * Helper to declare a singly linked list variable with automatic deep cleanup.
2691 * The list is deeply freed, in a way appropriate to the specified type, when the
2692 * variable goes out of scope. The type must support this.
2694 * This feature is only supported on GCC and clang. This macro is not
2695 * defined on other compilers and should not be used in programs that
2696 * are intended to be portable to those compilers.
2698 * This is meant to be used to declare lists of a type with a cleanup
2699 * function. The type of the variable is a GSList *. You
2700 * must not add your own '*'.
2702 * This macro can be used to avoid having to do explicit cleanups of
2703 * local variables when exiting functions. It often vastly simplifies
2704 * handling of error conditions, removing the need for various tricks
2705 * such as 'goto out' or repeating of cleanup code. It is also helpful
2706 * for non-error cases.
2708 * See also g_autolist(), g_autoptr() and g_steal_pointer().
2710 * Since: 2.56
2714 * G_DEFINE_AUTOPTR_CLEANUP_FUNC:
2715 * @TypeName: a type name to define a g_autoptr() cleanup function for
2716 * @func: the cleanup function
2718 * Defines the appropriate cleanup function for a pointer type.
2720 * The function will not be called if the variable to be cleaned up
2721 * contains %NULL.
2723 * This will typically be the _free() or _unref() function for the given
2724 * type.
2726 * With this definition, it will be possible to use g_autoptr() with
2727 * @TypeName.
2729 * |[
2730 * G_DEFINE_AUTOPTR_CLEANUP_FUNC(GObject, g_object_unref)
2731 * ]|
2733 * This macro should be used unconditionally; it is a no-op on compilers
2734 * where cleanup is not supported.
2736 * Since: 2.44
2740 * G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC:
2741 * @TypeName: a type name to define a g_auto() cleanup function for
2742 * @func: the clear function
2744 * Defines the appropriate cleanup function for a type.
2746 * This will typically be the _clear() function for the given type.
2748 * With this definition, it will be possible to use g_auto() with
2749 * @TypeName.
2751 * |[
2752 * G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GQueue, g_queue_clear)
2753 * ]|
2755 * This macro should be used unconditionally; it is a no-op on compilers
2756 * where cleanup is not supported.
2758 * Since: 2.44
2762 * G_DEFINE_AUTO_CLEANUP_FREE_FUNC:
2763 * @TypeName: a type name to define a g_auto() cleanup function for
2764 * @func: the free function
2765 * @none: the "none" value for the type
2767 * Defines the appropriate cleanup function for a type.
2769 * With this definition, it will be possible to use g_auto() with
2770 * @TypeName.
2772 * This function will be rarely used. It is used with pointer-based
2773 * typedefs and non-pointer types where the value of the variable
2774 * represents a resource that must be freed. Two examples are #GStrv
2775 * and file descriptors.
2777 * @none specifies the "none" value for the type in question. It is
2778 * probably something like %NULL or -1. If the variable is found to
2779 * contain this value then the free function will not be called.
2781 * |[
2782 * G_DEFINE_AUTO_CLEANUP_FREE_FUNC(GStrv, g_strfreev, NULL)
2783 * ]|
2785 * This macro should be used unconditionally; it is a no-op on compilers
2786 * where cleanup is not supported.
2788 * Since: 2.44
2791 /* Windows Compatibility Functions {{{1 */
2794 * SECTION:windows
2795 * @title: Windows Compatibility Functions
2796 * @short_description: UNIX emulation on Windows
2798 * These functions provide some level of UNIX emulation on the
2799 * Windows platform. If your application really needs the POSIX
2800 * APIs, we suggest you try the Cygwin project.
2804 * MAXPATHLEN:
2806 * Provided for UNIX emulation on Windows; equivalent to UNIX
2807 * macro %MAXPATHLEN, which is the maximum length of a filename
2808 * (including full path).
2812 * G_WIN32_DLLMAIN_FOR_DLL_NAME:
2813 * @static: empty or "static"
2814 * @dll_name: the name of the (pointer to the) char array where
2815 * the DLL name will be stored. If this is used, you must also
2816 * include `windows.h`. If you need a more complex DLL entry
2817 * point function, you cannot use this
2819 * On Windows, this macro defines a DllMain() function that stores
2820 * the actual DLL name that the code being compiled will be included in.
2822 * On non-Windows platforms, expands to nothing.
2826 * G_WIN32_HAVE_WIDECHAR_API:
2828 * On Windows, this macro defines an expression which evaluates to
2829 * %TRUE if the code is running on a version of Windows where the wide
2830 * character versions of the Win32 API functions, and the wide character
2831 * versions of the C library functions work. (They are always present in
2832 * the DLLs, but don't work on Windows 9x and Me.)
2834 * On non-Windows platforms, it is not defined.
2836 * Since: 2.6
2841 * G_WIN32_IS_NT_BASED:
2843 * On Windows, this macro defines an expression which evaluates to
2844 * %TRUE if the code is running on an NT-based Windows operating system.
2846 * On non-Windows platforms, it is not defined.
2848 * Since: 2.6
2851 /* Epilogue {{{1 */
2852 /* vim: set foldmethod=marker: */