summaryrefstree
path: root/usr/share/gtk-doc/html/glib/glib-Miscellaneous-Macros.html
blob: 397d80e3619fb492732e37301bfb5b9330d799cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Miscellaneous Macros</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1">
<link rel="home" href="index.html" title="GLib Reference Manual">
<link rel="up" href="glib-fundamentals.html" title="GLib Fundamentals">
<link rel="prev" href="glib-Numerical-Definitions.html" title="Numerical Definitions">
<link rel="next" href="glib-Atomic-Operations.html" title="Atomic Operations">
<meta name="generator" content="GTK-Doc V1.19 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2">
<tr valign="middle">
<td><a accesskey="p" href="glib-Numerical-Definitions.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td>
<td><a accesskey="u" href="glib-fundamentals.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td>
<th width="100%" align="center">GLib Reference Manual</th>
<td><a accesskey="n" href="glib-Atomic-Operations.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td>
</tr>
<tr><td colspan="5" class="shortcuts">
<a href="#glib-Miscellaneous-Macros.synopsis" class="shortcut">Top</a>
                   | 
                  <a href="#glib-Miscellaneous-Macros.description" class="shortcut">Description</a>
</td></tr>
</table>
<div class="refentry">
<a name="glib-Miscellaneous-Macros"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="glib-Miscellaneous-Macros.top_of_page"></a>Miscellaneous Macros</span></h2>
<p>Miscellaneous Macros — specialized macros which are not used often</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<a name="glib-Miscellaneous-Macros.synopsis"></a><h2>Synopsis</h2>
<pre class="synopsis">
#include &lt;glib.h&gt;

#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-INLINE-FUNC:CAPS" title="G_INLINE_FUNC">G_INLINE_FUNC</a>

#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-STMT-START:CAPS" title="G_STMT_START">G_STMT_START</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-STMT-END:CAPS" title="G_STMT_END">G_STMT_END</a>

#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-BEGIN-DECLS:CAPS" title="G_BEGIN_DECLS">G_BEGIN_DECLS</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-END-DECLS:CAPS" title="G_END_DECLS">G_END_DECLS</a>

#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-VA-COPY:CAPS" title="G_VA_COPY()">G_VA_COPY</a>                           (ap1,
                                                         ap2)

#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-STRINGIFY:CAPS" title="G_STRINGIFY()">G_STRINGIFY</a>                         (macro_or_string)
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-PASTE:CAPS" title="G_PASTE()">G_PASTE</a>                             (identifier1,
                                                         identifier2)
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-STATIC-ASSERT:CAPS" title="G_STATIC_ASSERT()">G_STATIC_ASSERT</a>                     (expr)
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-STATIC-ASSERT-EXPR:CAPS" title="G_STATIC_ASSERT_EXPR()">G_STATIC_ASSERT_EXPR</a>                (expr)

#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-EXTENSION:CAPS" title="G_GNUC_EXTENSION">G_GNUC_EXTENSION</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-CONST:CAPS" title="G_GNUC_CONST">G_GNUC_CONST</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-PURE:CAPS" title="G_GNUC_PURE">G_GNUC_PURE</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-MALLOC:CAPS" title="G_GNUC_MALLOC">G_GNUC_MALLOC</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-ALLOC-SIZE:CAPS" title="G_GNUC_ALLOC_SIZE()">G_GNUC_ALLOC_SIZE</a>                   (x)
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-ALLOC-SIZE2:CAPS" title="G_GNUC_ALLOC_SIZE2()">G_GNUC_ALLOC_SIZE2</a>                  (x,
                                                         y)
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-DEPRECATED:CAPS" title="G_GNUC_DEPRECATED">G_GNUC_DEPRECATED</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-DEPRECATED-FOR:CAPS" title="G_GNUC_DEPRECATED_FOR()">G_GNUC_DEPRECATED_FOR</a>               (f)
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-BEGIN-IGNORE-DEPRECATIONS:CAPS" title="G_GNUC_BEGIN_IGNORE_DEPRECATIONS">G_GNUC_BEGIN_IGNORE_DEPRECATIONS</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-END-IGNORE-DEPRECATIONS:CAPS" title="G_GNUC_END_IGNORE_DEPRECATIONS">G_GNUC_END_IGNORE_DEPRECATIONS</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-NORETURN:CAPS" title="G_GNUC_NORETURN">G_GNUC_NORETURN</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-UNUSED:CAPS" title="G_GNUC_UNUSED">G_GNUC_UNUSED</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-PRINTF:CAPS" title="G_GNUC_PRINTF()">G_GNUC_PRINTF</a>                       (format_idx,
                                                         arg_idx)
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-SCANF:CAPS" title="G_GNUC_SCANF()">G_GNUC_SCANF</a>                        (format_idx,
                                                         arg_idx)
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-FORMAT:CAPS" title="G_GNUC_FORMAT()">G_GNUC_FORMAT</a>                       (arg_idx)
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-NULL-TERMINATED:CAPS" title="G_GNUC_NULL_TERMINATED">G_GNUC_NULL_TERMINATED</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-WARN-UNUSED-RESULT:CAPS" title="G_GNUC_WARN_UNUSED_RESULT">G_GNUC_WARN_UNUSED_RESULT</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-FUNCTION:CAPS" title="G_GNUC_FUNCTION">G_GNUC_FUNCTION</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-PRETTY-FUNCTION:CAPS" title="G_GNUC_PRETTY_FUNCTION">G_GNUC_PRETTY_FUNCTION</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-NO-INSTRUMENT:CAPS" title="G_GNUC_NO_INSTRUMENT">G_GNUC_NO_INSTRUMENT</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-HAVE-GNUC-VISIBILITY:CAPS" title="G_HAVE_GNUC_VISIBILITY">G_HAVE_GNUC_VISIBILITY</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-INTERNAL:CAPS" title="G_GNUC_INTERNAL">G_GNUC_INTERNAL</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-MAY-ALIAS:CAPS" title="G_GNUC_MAY_ALIAS">G_GNUC_MAY_ALIAS</a>

#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-DEPRECATED:CAPS" title="G_DEPRECATED">G_DEPRECATED</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-DEPRECATED-FOR:CAPS" title="G_DEPRECATED_FOR()">G_DEPRECATED_FOR</a>                    (f)
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-UNAVAILABLE:CAPS" title="G_UNAVAILABLE()">G_UNAVAILABLE</a>                       (maj,
                                                         min)

#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-LIKELY:CAPS" title="G_LIKELY()">G_LIKELY</a>                            (expr)
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-UNLIKELY:CAPS" title="G_UNLIKELY()">G_UNLIKELY</a>                          (expr)

#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-STRLOC:CAPS" title="G_STRLOC">G_STRLOC</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-STRFUNC:CAPS" title="G_STRFUNC">G_STRFUNC</a>
</pre>
</div>
<div class="refsect1">
<a name="glib-Miscellaneous-Macros.description"></a><h2>Description</h2>
<p>
These macros provide more specialized features which are not
needed so often by application programmers.
</p>
</div>
<div class="refsect1">
<a name="glib-Miscellaneous-Macros.details"></a><h2>Details</h2>
<div class="refsect2">
<a name="G-INLINE-FUNC:CAPS"></a><h3>G_INLINE_FUNC</h3>
<pre class="programlisting">#  define G_INLINE_FUNC _GLIB_EXTERN
</pre>
<p>
This macro is used to export function prototypes so they can be linked
with an external version when no inlining is performed. The file which
implements the functions should define <code class="literal">G_IMPLEMENTS_INLINES</code>
before including the headers which contain <a class="link" href="glib-Miscellaneous-Macros.html#G-INLINE-FUNC:CAPS" title="G_INLINE_FUNC"><code class="literal">G_INLINE_FUNC</code></a> declarations.
Since inlining is very compiler-dependent using these macros correctly
is very difficult. Their use is strongly discouraged.
</p>
<p>
This macro is often mistaken for a replacement for the inline keyword;
inline is already declared in a portable manner in the GLib headers
and can be used normally.
</p>
</div>
<hr>
<div class="refsect2">
<a name="G-STMT-START:CAPS"></a><h3>G_STMT_START</h3>
<pre class="programlisting">#  define G_STMT_START  do
</pre>
<p>
Used within multi-statement macros so that they can be used in places
where only one statement is expected by the compiler.
</p>
</div>
<hr>
<div class="refsect2">
<a name="G-STMT-END:CAPS"></a><h3>G_STMT_END</h3>
<pre class="programlisting">#  define G_STMT_END    while (0)
</pre>
<p>
Used within multi-statement macros so that they can be used in places
where only one statement is expected by the compiler.
</p>
</div>
<hr>
<div class="refsect2">
<a name="G-BEGIN-DECLS:CAPS"></a><h3>G_BEGIN_DECLS</h3>
<pre class="programlisting"># define G_BEGIN_DECLS  extern "C" {
</pre>
<p>
Used (along with <a class="link" href="glib-Miscellaneous-Macros.html#G-END-DECLS:CAPS" title="G_END_DECLS"><span class="type">G_END_DECLS</span></a>) to bracket header files. If the
compiler in use is a C++ compiler, adds <code class="literal">extern "C"</code>
around the header.
</p>
</div>
<hr>
<div class="refsect2">
<a name="G-END-DECLS:CAPS"></a><h3>G_END_DECLS</h3>
<pre class="programlisting"># define G_END_DECLS    }
</pre>
<p>
Used (along with <a class="link" href="glib-Miscellaneous-Macros.html#G-BEGIN-DECLS:CAPS" title="G_BEGIN_DECLS"><span class="type">G_BEGIN_DECLS</span></a>) to bracket header files. If the
compiler in use is a C++ compiler, adds <code class="literal">extern "C"</code>
around the header.
</p>
</div>
<hr>
<div class="refsect2">
<a name="G-VA-COPY:CAPS"></a><h3>G_VA_COPY()</h3>
<pre class="programlisting">#define             G_VA_COPY(ap1,ap2)</pre>
<p>
Portable way to copy <span class="type">va_list</span> variables.
</p>
<p>
In order to use this function, you must include
<code class="filename">string.h</code> yourself, because this macro may
use <code class="function">memmove()</code> and GLib does not include <code class="filename">string.h</code>
for you.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>ap1</code></em> :</span></p></td>
<td>the <span class="type">va_list</span> variable to place a copy of <em class="parameter"><code>ap2</code></em> in</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>ap2</code></em> :</span></p></td>
<td>a <span class="type">va_list</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="G-STRINGIFY:CAPS"></a><h3>G_STRINGIFY()</h3>
<pre class="programlisting">#define G_STRINGIFY(macro_or_string) G_STRINGIFY_ARG (macro_or_string)
</pre>
<p>
Accepts a macro or a string and converts it into a string after
preprocessor argument expansion. For example, the following code:
</p>
<p>
</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="preproc">#define</span><span class="normal"> AGE </span><span class="number">27</span>
<span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">greeting </span><span class="symbol">=</span><span class="normal"> </span><span class="function"><a href="glib-Miscellaneous-Macros.html#G-STRINGIFY:CAPS">G_STRINGIFY</a></span><span class="normal"> </span><span class="symbol">(</span><span class="normal">AGE</span><span class="symbol">)</span><span class="normal"> </span><span class="string">" today!"</span><span class="symbol">;</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
</p>
<p>
is transformed by the preprocessor into (code equivalent to):
</p>
<p>
</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">greeting </span><span class="symbol">=</span><span class="normal"> </span><span class="string">"27 today!"</span><span class="symbol">;</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>macro_or_string</code></em> :</span></p></td>
<td>a macro or a string</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="G-PASTE:CAPS"></a><h3>G_PASTE()</h3>
<pre class="programlisting">#define G_PASTE(identifier1,identifier2)      G_PASTE_ARGS (identifier1, identifier2)
</pre>
<p>
Yields a new preprocessor pasted identifier
<code class="code">identifier1identifier2</code> from its expanded
arguments <em class="parameter"><code>identifier1</code></em> and <em class="parameter"><code>identifier2</code></em>. For example,
the following code:
</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="preproc">#define</span><span class="normal"> </span><span class="function">GET</span><span class="symbol">(</span><span class="normal">traveller</span><span class="symbol">,</span><span class="normal">method</span><span class="symbol">)</span><span class="normal"> </span><span class="function"><a href="glib-Miscellaneous-Macros.html#G-PASTE:CAPS">G_PASTE</a></span><span class="symbol">(</span><span class="normal">traveller_get_</span><span class="symbol">,</span><span class="normal"> method</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">traveller</span><span class="symbol">)</span>
<span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">name </span><span class="symbol">=</span><span class="normal"> </span><span class="function">GET</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">traveller</span><span class="symbol">,</span><span class="normal"> name</span><span class="symbol">);</span>
<span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">quest </span><span class="symbol">=</span><span class="normal"> </span><span class="function">GET</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">traveller</span><span class="symbol">,</span><span class="normal"> quest</span><span class="symbol">);</span>
<span class="usertype">GdkColor</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">favourite </span><span class="symbol">=</span><span class="normal"> </span><span class="function">GET</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">traveller</span><span class="symbol">,</span><span class="normal"> favourite_colour</span><span class="symbol">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
</p>
<p>
is transformed by the preprocessor into:
</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">name </span><span class="symbol">=</span><span class="normal"> </span><span class="function">traveller_get_name</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">traveller</span><span class="symbol">);</span>
<span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">quest </span><span class="symbol">=</span><span class="normal"> </span><span class="function">traveller_get_quest</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">traveller</span><span class="symbol">);</span>
<span class="usertype">GdkColor</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">favourite </span><span class="symbol">=</span><span class="normal"> </span><span class="function">traveller_get_favourite_colour</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">traveller</span><span class="symbol">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>identifier1</code></em> :</span></p></td>
<td>an identifier</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>identifier2</code></em> :</span></p></td>
<td>an identifier</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.20</p>
</div>
<hr>
<div class="refsect2">
<a name="G-STATIC-ASSERT:CAPS"></a><h3>G_STATIC_ASSERT()</h3>
<pre class="programlisting">#define G_STATIC_ASSERT(expr) typedef char G_PASTE (_GStaticAssertCompileTimeAssertion_, __COUNTER__)[(expr) ? 1 : -1] G_GNUC_UNUSED
</pre>
<p>
The G_STATIC_ASSERT macro lets the programmer check
a condition at compile time, the condition needs to
be compile time computable. The macro can be used in
any place where a <code class="literal">typedef</code> is valid.
</p>
<p>
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
<p>
A <code class="literal">typedef</code> is generally allowed in
exactly the same places that a variable declaration is
allowed. For this reason, you should not use
<code class="literal">G_STATIC_ASSERT</code> in the middle of
blocks of code.
</p>
</div>
<p>
</p>
<p>
The macro should only be used once per source code line.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>expr</code></em> :</span></p></td>
<td>a constant expression</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.20</p>
</div>
<hr>
<div class="refsect2">
<a name="G-STATIC-ASSERT-EXPR:CAPS"></a><h3>G_STATIC_ASSERT_EXPR()</h3>
<pre class="programlisting">#define G_STATIC_ASSERT_EXPR(expr) ((void) sizeof (char[(expr) ? 1 : -1]))
</pre>
<p>
The G_STATIC_ASSERT_EXPR macro lets the programmer check
a condition at compile time. The condition needs to be
compile time computable.
</p>
<p>
Unlike <code class="literal">G_STATIC_ASSERT</code>, this macro
evaluates to an expression and, as such, can be used in
the middle of other expressions. Its value should be
ignored. This can be accomplished by placing it as
the first argument of a comma expression.
</p>
<p>
</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="preproc">#define</span><span class="normal"> </span><span class="function">ADD_ONE_TO_INT</span><span class="symbol">(</span><span class="normal">x</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">\</span>
<span class="normal">  </span><span class="symbol">(</span><span class="function"><a href="glib-Miscellaneous-Macros.html#G-STATIC-ASSERT-EXPR:CAPS">G_STATIC_ASSERT_EXPR</a></span><span class="symbol">(</span><span class="keyword">sizeof</span><span class="normal"> </span><span class="symbol">(</span><span class="normal">x</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="keyword">sizeof</span><span class="normal"> </span><span class="symbol">(</span><span class="type">int</span><span class="symbol">)),</span><span class="normal"> </span><span class="symbol">((</span><span class="normal">x</span><span class="symbol">)</span><span class="normal"> </span><span class="symbol">+</span><span class="normal"> </span><span class="number">1</span><span class="symbol">))</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>expr</code></em> :</span></p></td>
<td>a constant expression</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.30</p>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-EXTENSION:CAPS"></a><h3>G_GNUC_EXTENSION</h3>
<pre class="programlisting">#  define G_GNUC_EXTENSION __extension__
</pre>
<p>
Expands to <code class="literal">__extension__</code> when <span class="command"><strong>gcc</strong></span>
is used as the compiler. This simply tells <span class="command"><strong>gcc</strong></span> not
to warn about the following non-standard code when compiling with the
<code class="option">-pedantic</code> option.
</p>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-CONST:CAPS"></a><h3>G_GNUC_CONST</h3>
<pre class="programlisting">#define             G_GNUC_CONST</pre>
<p>
Expands to the GNU C <code class="literal">const</code> function attribute if
the compiler is <span class="command"><strong>gcc</strong></span>. Declaring a function as const
enables better optimization of calls to the function. A const function
doesn't examine any values except its parameters, and has no effects
except its return value.
</p>
<p>
Place the attribute after the declaration, just before the semicolon.
</p>
<p>
See the GNU C documentation for more details.
</p>
<p>
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
<p>
A function that has pointer arguments and examines the data pointed to
must <span class="emphasis"><em>not</em></span> be declared const. Likewise, a function
that calls a non-const function usually must not be const. It doesn't
make sense for a const function to return void.
</p>
</div>
<p>
</p>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-PURE:CAPS"></a><h3>G_GNUC_PURE</h3>
<pre class="programlisting">#define             G_GNUC_PURE</pre>
<p>
Expands to the GNU C <code class="literal">pure</code> function attribute if the
compiler is <span class="command"><strong>gcc</strong></span>. Declaring a function as pure enables
better optimization of calls to the function. A pure function has no
effects except its return value and the return value depends only on
the parameters and/or global variables.
</p>
<p>
Place the attribute after the declaration, just before the semicolon.
</p>
<p>
See the GNU C documentation for more details.
</p>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-MALLOC:CAPS"></a><h3>G_GNUC_MALLOC</h3>
<pre class="programlisting">#define             G_GNUC_MALLOC</pre>
<p>
Expands to the GNU C <code class="literal">malloc</code> function attribute if the
compiler is <span class="command"><strong>gcc</strong></span>. Declaring a function as malloc enables
better optimization of the function. A function can have the malloc
attribute if it returns a pointer which is guaranteed to not alias with
any other pointer when the function returns (in practice, this means newly
allocated memory).
</p>
<p>
Place the attribute after the declaration, just before the semicolon.
</p>
<p>
See the GNU C documentation for more details.
</p>
<p class="since">Since 2.6</p>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-ALLOC-SIZE:CAPS"></a><h3>G_GNUC_ALLOC_SIZE()</h3>
<pre class="programlisting">#define G_GNUC_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
</pre>
<p>
Expands to the GNU C <code class="literal">alloc_size</code> function attribute
if the compiler is a new enough <span class="command"><strong>gcc</strong></span>. This attribute
tells the compiler that the function returns a pointer to memory of a
size that is specified by the <em class="parameter"><code>x</code></em>th function parameter.
</p>
<p>
Place the attribute after the function declaration, just before the
semicolon.
</p>
<p>
See the GNU C documentation for more details.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td>
<td>the index of the argument specifying the allocation size</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.18</p>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-ALLOC-SIZE2:CAPS"></a><h3>G_GNUC_ALLOC_SIZE2()</h3>
<pre class="programlisting">#define G_GNUC_ALLOC_SIZE2(x,y) __attribute__((__alloc_size__(x,y)))
</pre>
<p>
Expands to the GNU C <code class="literal">alloc_size</code> function attribute
if the compiler is a new enough <span class="command"><strong>gcc</strong></span>. This attribute
tells the compiler that the function returns a pointer to memory of a
size that is specified by the product of two function parameters.
</p>
<p>
Place the attribute after the function declaration, just before the
semicolon.
</p>
<p>
See the GNU C documentation for more details.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>x</code></em> :</span></p></td>
<td>the index of the argument specifying one factor of the allocation size</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>y</code></em> :</span></p></td>
<td>the index of the argument specifying the second factor of the allocation size</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.18</p>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-DEPRECATED:CAPS"></a><h3>G_GNUC_DEPRECATED</h3>
<pre class="programlisting">#define             G_GNUC_DEPRECATED</pre>
<p>
Expands to the GNU C <code class="literal">deprecated</code> attribute if the
compiler is <span class="command"><strong>gcc</strong></span>. It can be used to mark typedefs,
variables and functions as deprecated. When called with the
<code class="option">-Wdeprecated-declarations</code> option, the compiler will
generate warnings when deprecated interfaces are used.
</p>
<p>
Place the attribute after the declaration, just before the semicolon.
</p>
<p>
See the GNU C documentation for more details.
</p>
<p class="since">Since 2.2</p>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-DEPRECATED-FOR:CAPS"></a><h3>G_GNUC_DEPRECATED_FOR()</h3>
<pre class="programlisting">#define             G_GNUC_DEPRECATED_FOR(f)</pre>
<p>
Like <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-DEPRECATED:CAPS" title="G_GNUC_DEPRECATED"><code class="literal">G_GNUC_DEPRECATED</code></a>, but names the intended replacement for the
deprecated symbol if the version of <span class="command"><strong>gcc</strong></span> in use is
new enough to support custom deprecation messages.
</p>
<p>
Place the attribute after the declaration, just before the semicolon.
</p>
<p>
See the GNU C documentation for more details.
</p>
<p>
Note that if <em class="parameter"><code>f</code></em> is a macro, it will be expanded in the warning message.
You can enclose it in quotes to prevent this. (The quotes will show up
in the warning, but it's better than showing the macro expansion.)
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>f</code></em> :</span></p></td>
<td>the intended replacement for the deprecated symbol,
such as the name of a function</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.26</p>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-BEGIN-IGNORE-DEPRECATIONS:CAPS"></a><h3>G_GNUC_BEGIN_IGNORE_DEPRECATIONS</h3>
<pre class="programlisting">#define             G_GNUC_BEGIN_IGNORE_DEPRECATIONS</pre>
<p>
Tells <span class="command"><strong>gcc</strong></span> (if it is a new enough version) to
temporarily stop emitting warnings when functions marked with
<a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-DEPRECATED:CAPS" title="G_GNUC_DEPRECATED"><code class="literal">G_GNUC_DEPRECATED</code></a> or <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-DEPRECATED-FOR:CAPS" title="G_GNUC_DEPRECATED_FOR()"><code class="literal">G_GNUC_DEPRECATED_FOR</code></a> are called. This is
useful for when you have one deprecated function calling another
one, or when you still have regression tests for deprecated
functions.
</p>
<p>
Use <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-END-IGNORE-DEPRECATIONS:CAPS" title="G_GNUC_END_IGNORE_DEPRECATIONS"><code class="literal">G_GNUC_END_IGNORE_DEPRECATIONS</code></a> to begin warning again. (If you
are not compiling with <code class="literal">-Wdeprecated-declarations</code>
then neither macro has any effect.)
</p>
<p>
This macro can be used either inside or outside of a function body,
but must appear on a line by itself.
</p>
<p class="since">Since 2.32</p>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-END-IGNORE-DEPRECATIONS:CAPS"></a><h3>G_GNUC_END_IGNORE_DEPRECATIONS</h3>
<pre class="programlisting">#define             G_GNUC_END_IGNORE_DEPRECATIONS</pre>
<p>
Undoes the effect of <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-BEGIN-IGNORE-DEPRECATIONS:CAPS" title="G_GNUC_BEGIN_IGNORE_DEPRECATIONS"><code class="literal">G_GNUC_BEGIN_IGNORE_DEPRECATIONS</code></a>, telling
<span class="command"><strong>gcc</strong></span> to begin outputting warnings again
(assuming those warnings had been enabled to begin with).
</p>
<p>
This macro can be used either inside or outside of a function body,
but must appear on a line by itself.
</p>
<p class="since">Since 2.32</p>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-NORETURN:CAPS"></a><h3>G_GNUC_NORETURN</h3>
<pre class="programlisting">#define             G_GNUC_NORETURN</pre>
<p>
Expands to the GNU C <code class="literal">noreturn</code> function attribute
if the compiler is <span class="command"><strong>gcc</strong></span>. It is used for declaring
functions which never return. It enables optimization of the function,
and avoids possible compiler warnings.
</p>
<p>
Place the attribute after the declaration, just before the semicolon.
</p>
<p>
See the GNU C documentation for more details.
</p>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-UNUSED:CAPS"></a><h3>G_GNUC_UNUSED</h3>
<pre class="programlisting">#define             G_GNUC_UNUSED</pre>
<p>
Expands to the GNU C <code class="literal">unused</code> function attribute if
the compiler is <span class="command"><strong>gcc</strong></span>. It is used for declaring
functions and arguments which may never be used. It avoids possible compiler
warnings.
</p>
<p>
For functions, place the attribute after the declaration, just before the
semicolon. For arguments, place the attribute at the beginning of the
argument declaration.
</p>
<p>
</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="type">void</span><span class="normal"> </span><span class="function">my_unused_function</span><span class="normal"> </span><span class="symbol">(</span><span class="normal"><a href="glib-Miscellaneous-Macros.html#G-GNUC-UNUSED:CAPS">G_GNUC_UNUSED</a> </span><span class="usertype">gint</span><span class="normal"> unused_argument</span><span class="symbol">,</span>
<span class="normal">                         </span><span class="usertype">gint</span><span class="normal"> other_argument</span><span class="symbol">)</span><span class="normal"> <a href="glib-Miscellaneous-Macros.html#G-GNUC-UNUSED:CAPS">G_GNUC_UNUSED</a></span><span class="symbol">;</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
</p>
<p>
See the GNU C documentation for more details.
</p>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-PRINTF:CAPS"></a><h3>G_GNUC_PRINTF()</h3>
<pre class="programlisting">#define             G_GNUC_PRINTF( format_idx, arg_idx )</pre>
<p>
Expands to the GNU C <code class="literal">format</code> function attribute
if the compiler is <span class="command"><strong>gcc</strong></span>. This is used for declaring
functions which take a variable number of arguments, with the same
syntax as <code class="function">printf()</code>. It allows the compiler to type-check the arguments
passed to the function.
</p>
<p>
Place the attribute after the function declaration, just before the
semicolon.
</p>
<p>
See the GNU C documentation for more details.
</p>
<p>
</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="usertype">gint</span><span class="normal"> </span><span class="function"><a href="glib-String-Utility-Functions.html#g-snprintf">g_snprintf</a></span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">gchar</span><span class="normal">  </span><span class="symbol">*</span><span class="normal">string</span><span class="symbol">,</span>
<span class="normal">                 </span><span class="usertype">gulong</span><span class="normal">       n</span><span class="symbol">,</span>
<span class="normal">                 </span><span class="usertype">gchar</span><span class="normal"> </span><span class="keyword">const</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">format</span><span class="symbol">,</span>
<span class="normal">                 </span><span class="symbol">...)</span><span class="normal"> </span><span class="function"><a href="glib-Miscellaneous-Macros.html#G-GNUC-PRINTF:CAPS">G_GNUC_PRINTF</a></span><span class="normal"> </span><span class="symbol">(</span><span class="number">3</span><span class="symbol">,</span><span class="normal"> </span><span class="number">4</span><span class="symbol">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>format_idx</code></em> :</span></p></td>
<td>the index of the argument corresponding to the
format string (The arguments are numbered from 1)</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>arg_idx</code></em> :</span></p></td>
<td>the index of the first of the format arguments</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-SCANF:CAPS"></a><h3>G_GNUC_SCANF()</h3>
<pre class="programlisting">#define             G_GNUC_SCANF( format_idx, arg_idx )</pre>
<p>
Expands to the GNU C <code class="literal">format</code> function attribute
if the compiler is <span class="command"><strong>gcc</strong></span>. This is used for declaring
functions which take a variable number of arguments, with the same
syntax as <code class="function">scanf()</code>. It allows the compiler to type-check the arguments
passed to the function. See the GNU C documentation for details.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>format_idx</code></em> :</span></p></td>
<td>the index of the argument corresponding to
the format string (The arguments are numbered from 1)</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>arg_idx</code></em> :</span></p></td>
<td>the index of the first of the format arguments</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-FORMAT:CAPS"></a><h3>G_GNUC_FORMAT()</h3>
<pre class="programlisting">#define             G_GNUC_FORMAT( arg_idx )</pre>
<p>
Expands to the GNU C <code class="literal">format_arg</code> function attribute
if the compiler is <span class="command"><strong>gcc</strong></span>. This function attribute
specifies that a function takes a format string for a <code class="function">printf()</code>,
<code class="function">scanf()</code>, <code class="function">strftime()</code> or <code class="function">strfmon()</code> style function and modifies it,
so that the result can be passed to a <code class="function">printf()</code>, <code class="function">scanf()</code>, <code class="function">strftime()</code>
or <code class="function">strfmon()</code> style function (with the remaining arguments to the
format function the same as they would have been for the unmodified
string).
</p>
<p>
Place the attribute after the function declaration, just before the
semicolon.
</p>
<p>
See the GNU C documentation for more details.
</p>
<p>
</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="function"><a href="glib-I18N.html#g-dgettext">g_dgettext</a></span><span class="normal"> </span><span class="symbol">(</span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">domain_name</span><span class="symbol">,</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal"> </span><span class="symbol">*</span><span class="normal">msgid</span><span class="symbol">)</span><span class="normal"> </span><span class="function"><a href="glib-Miscellaneous-Macros.html#G-GNUC-FORMAT:CAPS">G_GNUC_FORMAT</a></span><span class="normal"> </span><span class="symbol">(</span><span class="number">2</span><span class="symbol">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>arg_idx</code></em> :</span></p></td>
<td>the index of the argument</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-NULL-TERMINATED:CAPS"></a><h3>G_GNUC_NULL_TERMINATED</h3>
<pre class="programlisting">#define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
</pre>
<p>
Expands to the GNU C <code class="literal">sentinel</code> function attribute
if the compiler is <span class="command"><strong>gcc</strong></span>, or "" if it isn't. This
function attribute only applies to variadic functions and instructs
the compiler to check that the argument list is terminated with an
explicit <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.
</p>
<p>
Place the attribute after the declaration, just before the semicolon.
</p>
<p>
See the GNU C documentation for more details.
</p>
<p class="since">Since 2.8</p>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-WARN-UNUSED-RESULT:CAPS"></a><h3>G_GNUC_WARN_UNUSED_RESULT</h3>
<pre class="programlisting">#define             G_GNUC_WARN_UNUSED_RESULT</pre>
<p>
Expands to the GNU C <code class="literal">warn_unused_result</code> function
attribute if the compiler is <span class="command"><strong>gcc</strong></span>, or "" if it isn't.
This function attribute makes the compiler emit a warning if the result
of a function call is ignored.
</p>
<p>
Place the attribute after the declaration, just before the semicolon.
</p>
<p>
See the GNU C documentation for more details.
</p>
<p class="since">Since 2.10</p>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-FUNCTION:CAPS"></a><h3>G_GNUC_FUNCTION</h3>
<pre class="programlisting">#define G_GNUC_FUNCTION         __FUNCTION__
</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">G_GNUC_FUNCTION</code> has been deprecated since version 2.16 and should not be used in newly-written code. Use <a class="link" href="glib-Miscellaneous-Macros.html#G-STRFUNC:CAPS" title="G_STRFUNC"><span class="type">G_STRFUNC</span></a> instead</p>
</div>
<p>
Expands to "" on all modern compilers, and to
<code class="literal">__FUNCTION__</code> on <span class="command"><strong>gcc</strong></span> version 2.x.
Don't use it.
</p>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-PRETTY-FUNCTION:CAPS"></a><h3>G_GNUC_PRETTY_FUNCTION</h3>
<pre class="programlisting">#define G_GNUC_PRETTY_FUNCTION  __PRETTY_FUNCTION__
</pre>
<div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Warning</h3>
<p><code class="literal">G_GNUC_PRETTY_FUNCTION</code> has been deprecated since version 2.16 and should not be used in newly-written code. Use <a class="link" href="glib-Miscellaneous-Macros.html#G-STRFUNC:CAPS" title="G_STRFUNC"><span class="type">G_STRFUNC</span></a> instead</p>
</div>
<p>
Expands to "" on all modern compilers, and to
<code class="literal">__PRETTY_FUNCTION__</code> on <span class="command"><strong>gcc</strong></span>
version 2.x. Don't use it.
</p>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-NO-INSTRUMENT:CAPS"></a><h3>G_GNUC_NO_INSTRUMENT</h3>
<pre class="programlisting">#define             G_GNUC_NO_INSTRUMENT</pre>
<p>
Expands to the GNU C <code class="literal">no_instrument_function</code> function
attribute if the compiler is <span class="command"><strong>gcc</strong></span>. Functions with this
attribute will not be instrumented for profiling, when the compiler is
called with the <code class="option">-finstrument-functions</code> option.
</p>
<p>
Place the attribute after the declaration, just before the semicolon.
</p>
<p>
See the GNU C documentation for more details.
</p>
</div>
<hr>
<div class="refsect2">
<a name="G-HAVE-GNUC-VISIBILITY:CAPS"></a><h3>G_HAVE_GNUC_VISIBILITY</h3>
<pre class="programlisting">#define G_HAVE_GNUC_VISIBILITY 1
</pre>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-INTERNAL:CAPS"></a><h3>G_GNUC_INTERNAL</h3>
<pre class="programlisting">#define G_GNUC_INTERNAL __attribute__((visibility("hidden")))
</pre>
<p>
This attribute can be used for marking library functions as being used
internally to the library only, which may allow the compiler to handle
function calls more efficiently. Note that static functions do not need
to be marked as internal in this way. See the GNU C documentation for
details.
</p>
<p>
When using a compiler that supports the GNU C hidden visibility attribute,
this macro expands to <code class="literal">__attribute__((visibility("hidden")))</code>.
When using the Sun Studio compiler, it expands to <code class="literal">__hidden</code>.
</p>
<p>
Note that for portability, the attribute should be placed before the
function declaration. While GCC allows the macro after the declaration,
Sun Studio does not.
</p>
<p>
</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="normal"><a href="glib-Miscellaneous-Macros.html#G-GNUC-INTERNAL:CAPS">G_GNUC_INTERNAL</a></span>
<span class="type">void</span><span class="normal"> </span><span class="function">_g_log_fallback_handler</span><span class="normal"> </span><span class="symbol">(</span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">    </span><span class="symbol">*</span><span class="normal">log_domain</span><span class="symbol">,</span>
<span class="normal">                              </span><span class="usertype">GLogLevelFlags</span><span class="normal">  log_level</span><span class="symbol">,</span>
<span class="normal">                              </span><span class="keyword">const</span><span class="normal"> </span><span class="usertype">gchar</span><span class="normal">    </span><span class="symbol">*</span><span class="normal">message</span><span class="symbol">,</span>
<span class="normal">                              </span><span class="usertype">gpointer</span><span class="normal">        unused_data</span><span class="symbol">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
</p>
<p class="since">Since 2.6</p>
</div>
<hr>
<div class="refsect2">
<a name="G-GNUC-MAY-ALIAS:CAPS"></a><h3>G_GNUC_MAY_ALIAS</h3>
<pre class="programlisting">#  define G_GNUC_MAY_ALIAS __attribute__((may_alias))
</pre>
<p>
Expands to the GNU C <code class="literal">may_alias</code> type attribute
if the compiler is <span class="command"><strong>gcc</strong></span>. Types with this attribute
will not be subjected to type-based alias analysis, but are assumed
to alias with any other type, just like char.
See the GNU C documentation for details.
</p>
<p class="since">Since 2.14</p>
</div>
<hr>
<div class="refsect2">
<a name="G-DEPRECATED:CAPS"></a><h3>G_DEPRECATED</h3>
<pre class="programlisting">#define G_DEPRECATED __attribute__((__deprecated__))
</pre>
<p>
This macro is similar to <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-DEPRECATED:CAPS" title="G_GNUC_DEPRECATED"><code class="literal">G_GNUC_DEPRECATED</code></a>, and can be used to mark
functions declarations as deprecated. Unlike <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-DEPRECATED:CAPS" title="G_GNUC_DEPRECATED"><code class="literal">G_GNUC_DEPRECATED</code></a>, it is
meant to be portable across different compilers and must be placed
before the function declaration.
</p>
<p class="since">Since 2.32</p>
</div>
<hr>
<div class="refsect2">
<a name="G-DEPRECATED-FOR:CAPS"></a><h3>G_DEPRECATED_FOR()</h3>
<pre class="programlisting">#define G_DEPRECATED_FOR(f) __attribute__((__deprecated__("Use '" #f "' instead")))
</pre>
<p>
This macro is similar to <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-DEPRECATED-FOR:CAPS" title="G_GNUC_DEPRECATED_FOR()"><code class="literal">G_GNUC_DEPRECATED_FOR</code></a>, and can be used to mark
functions declarations as deprecated. Unlike <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-DEPRECATED-FOR:CAPS" title="G_GNUC_DEPRECATED_FOR()"><code class="literal">G_GNUC_DEPRECATED_FOR</code></a>, it is
meant to be portable across different compilers and must be placed
before the function declaration.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>f</code></em> :</span></p></td>
<td>the name of the function that this function was deprecated for</td>
</tr></tbody>
</table></div>
<p class="since">Since 2.32</p>
</div>
<hr>
<div class="refsect2">
<a name="G-UNAVAILABLE:CAPS"></a><h3>G_UNAVAILABLE()</h3>
<pre class="programlisting">#define G_UNAVAILABLE(maj,min) __attribute__((deprecated("Not available before " #maj "." #min)))
</pre>
<p>
This macro can be used to mark a function declaration as unavailable.
It must be placed before the function declaration. Use of a function
that has been annotated with this macros will produce a compiler warning.
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>maj</code></em> :</span></p></td>
<td>the major version that introduced the symbol</td>
</tr>
<tr>
<td><p><span class="term"><em class="parameter"><code>min</code></em> :</span></p></td>
<td>the minor version that introduced the symbol</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.32</p>
</div>
<hr>
<div class="refsect2">
<a name="G-LIKELY:CAPS"></a><h3>G_LIKELY()</h3>
<pre class="programlisting">#define G_LIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 1))
</pre>
<p>
Hints the compiler that the expression is likely to evaluate to
a true value. The compiler may use this information for optimizations.
</p>
<p>
</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="glib-Miscellaneous-Macros.html#G-LIKELY:CAPS">G_LIKELY</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">random</span><span class="normal"> </span><span class="symbol">()</span><span class="normal"> </span><span class="symbol">!=</span><span class="normal"> </span><span class="number">1</span><span class="symbol">))</span>
<span class="normal">  </span><span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"not one"</span><span class="symbol">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>expr</code></em> :</span></p></td>
<td>the expression</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the value of <em class="parameter"><code>expr</code></em>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.2</p>
</div>
<hr>
<div class="refsect2">
<a name="G-UNLIKELY:CAPS"></a><h3>G_UNLIKELY()</h3>
<pre class="programlisting">#define G_UNLIKELY(expr) (__builtin_expect (_G_BOOLEAN_EXPR(expr), 0))
</pre>
<p>
Hints the compiler that the expression is unlikely to evaluate to
a true value. The compiler may use this information for optimizations.
</p>
<p>
</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="keyword">if</span><span class="normal"> </span><span class="symbol">(</span><span class="function"><a href="glib-Miscellaneous-Macros.html#G-UNLIKELY:CAPS">G_UNLIKELY</a></span><span class="normal"> </span><span class="symbol">(</span><span class="function">random</span><span class="normal"> </span><span class="symbol">()</span><span class="normal"> </span><span class="symbol">==</span><span class="normal"> </span><span class="number">1</span><span class="symbol">))</span>
<span class="normal">  </span><span class="function"><a href="glib-Warnings-and-Assertions.html#g-print">g_print</a></span><span class="normal"> </span><span class="symbol">(</span><span class="string">"a random one"</span><span class="symbol">);</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p>
</p>
<div class="variablelist"><table border="0" class="variablelist">
<colgroup>
<col align="left" valign="top">
<col>
</colgroup>
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>expr</code></em> :</span></p></td>
<td>the expression</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td>
<td>the value of <em class="parameter"><code>expr</code></em>
</td>
</tr>
</tbody>
</table></div>
<p class="since">Since 2.2</p>
</div>
<hr>
<div class="refsect2">
<a name="G-STRLOC:CAPS"></a><h3>G_STRLOC</h3>
<pre class="programlisting">#  define G_STRLOC __FILE__ ":" G_STRINGIFY (__LINE__) ":" __PRETTY_FUNCTION__ "()"
</pre>
<p>
Expands to a string identifying the current code position.
</p>
</div>
<hr>
<div class="refsect2">
<a name="G-STRFUNC:CAPS"></a><h3>G_STRFUNC</h3>
<pre class="programlisting">#  define G_STRFUNC     ((const char*) (__PRETTY_FUNCTION__))
</pre>
<p>
Expands to a string identifying the current function.
</p>
<p class="since">Since 2.4</p>
</div>
</div>
</div>
<div class="footer">
<hr>
          Generated by GTK-Doc V1.19</div>
</body>
</html>