~ubuntu-branches/ubuntu/trusty/glib2.0/trusty-proposed

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
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Miscellaneous Macros</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2">
<link rel="start" 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.9 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
<link rel="chapter" href="glib.html" title="GLib Overview">
<link rel="chapter" href="glib-fundamentals.html" title="GLib Fundamentals">
<link rel="chapter" href="glib-core.html" title="GLib Core Application Support">
<link rel="chapter" href="glib-utilities.html" title="GLib Utilities">
<link rel="chapter" href="glib-data-types.html" title="GLib Data Types">
<link rel="chapter" href="tools.html" title="GLib Tools">
<link rel="index" href="ix01.html" title="Index">
<link rel="index" href="ix02.html" title="Index of deprecated symbols">
<link rel="index" href="ix03.html" title="Index of new symbols in 2.2">
<link rel="index" href="ix04.html" title="Index of new symbols in 2.4">
<link rel="index" href="ix05.html" title="Index of new symbols in 2.6">
<link rel="index" href="ix06.html" title="Index of new symbols in 2.8">
<link rel="index" href="ix07.html" title="Index of new symbols in 2.10">
<link rel="index" href="ix08.html" title="Index of new symbols in 2.12">
<link rel="index" href="ix09.html" title="Index of new symbols in 2.14">
<link rel="index" href="ix10.html" title="Index of new symbols in 2.16">
</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"><nobr><a href="#id2838660" class="shortcut">Top</a>
                  &#160;|&#160;
                  <a href="#id2839056" class="shortcut">Description</a></nobr></td></tr>
</table>
<div class="refentry" lang="en">
<a name="glib-Miscellaneous-Macros"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2>
<a name="id2838660"></a><span class="refentrytitle">Miscellaneous Macros</span>
</h2>
<p>Miscellaneous Macros &#8212; specialized macros which are not used often</p>
</td>
<td valign="top" align="right"></td>
</tr></table></div>
<div class="refsynopsisdiv">
<h2>Synopsis</h2>
<pre class="synopsis">

#include &lt;glib.h&gt;


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

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

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

#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-N-ELEMENTS:CAPS">G_N_ELEMENTS</a>                        (arr)

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

#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-STRINGIFY:CAPS">G_STRINGIFY</a>                         (macro_or_string)

#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-EXTENSION:CAPS">G_GNUC_EXTENSION</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-CONST:CAPS">G_GNUC_CONST</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-PURE:CAPS">G_GNUC_PURE</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-MALLOC:CAPS">G_GNUC_MALLOC</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-DEPRECATED:CAPS">G_GNUC_DEPRECATED</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-NORETURN:CAPS">G_GNUC_NORETURN</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-UNUSED:CAPS">G_GNUC_UNUSED</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-PRINTF:CAPS">G_GNUC_PRINTF</a>                       ( format_idx, arg_idx )
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-SCANF:CAPS">G_GNUC_SCANF</a>                        ( format_idx, arg_idx )
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-FORMAT:CAPS">G_GNUC_FORMAT</a>                       ( arg_idx )
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-NULL-TERMINATED:CAPS">G_GNUC_NULL_TERMINATED</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-WARN-UNUSED-RESULT:CAPS">G_GNUC_WARN_UNUSED_RESULT</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-FUNCTION:CAPS">G_GNUC_FUNCTION</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-PRETTY-FUNCTION:CAPS">G_GNUC_PRETTY_FUNCTION</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-NO-INSTRUMENT:CAPS">G_GNUC_NO_INSTRUMENT</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-HAVE-GNUC-VISIBILITY:CAPS">G_HAVE_GNUC_VISIBILITY</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-INTERNAL:CAPS">G_GNUC_INTERNAL</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GNUC-MAY-ALIAS:CAPS">G_GNUC_MAY_ALIAS</a>

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

#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-STRLOC:CAPS">G_STRLOC</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-STRFUNC:CAPS">G_STRFUNC</a>

#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT16-MODIFIER:CAPS">G_GINT16_MODIFIER</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT16-FORMAT:CAPS">G_GINT16_FORMAT</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GUINT16-FORMAT:CAPS">G_GUINT16_FORMAT</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT32-MODIFIER:CAPS">G_GINT32_MODIFIER</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT32-FORMAT:CAPS">G_GINT32_FORMAT</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GUINT32-FORMAT:CAPS">G_GUINT32_FORMAT</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT64-MODIFIER:CAPS">G_GINT64_MODIFIER</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT64-FORMAT:CAPS">G_GINT64_FORMAT</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GUINT64-FORMAT:CAPS">G_GUINT64_FORMAT</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GSIZE-MODIFIER:CAPS">G_GSIZE_MODIFIER</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GSIZE-FORMAT:CAPS">G_GSIZE_FORMAT</a>
#define             <a class="link" href="glib-Miscellaneous-Macros.html#G-GSSIZE-FORMAT:CAPS">G_GSSIZE_FORMAT</a>

</pre>
</div>
<div class="refsect1" lang="en">
<a name="id2839056"></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" lang="en">
<a name="id2839072"></a><h2>Details</h2>
<div class="refsect2" lang="en">
<a name="id2839082"></a><h3>
<a name="G-INLINE-FUNC:CAPS"></a>G_INLINE_FUNC</h3>
<a class="indexterm" name="id2839094"></a><pre class="programlisting">#define             G_INLINE_FUNC</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"><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" lang="en">
<a name="id2839144"></a><h3>
<a name="G-STMT-START:CAPS"></a>G_STMT_START</h3>
<a class="indexterm" name="id2839156"></a><pre class="programlisting">#define             G_STMT_START</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" lang="en">
<a name="id2839174"></a><h3>
<a name="G-STMT-END:CAPS"></a>G_STMT_END</h3>
<a class="indexterm" name="id2839187"></a><pre class="programlisting">#define             G_STMT_END</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" lang="en">
<a name="id2839204"></a><h3>
<a name="G-BEGIN-DECLS:CAPS"></a>G_BEGIN_DECLS</h3>
<a class="indexterm" name="id2839217"></a><pre class="programlisting">#define             G_BEGIN_DECLS</pre>
<p>
Used (along with <a class="link" href="glib-Miscellaneous-Macros.html#G-END-DECLS:CAPS"><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" lang="en">
<a name="id2839248"></a><h3>
<a name="G-END-DECLS:CAPS"></a>G_END_DECLS</h3>
<a class="indexterm" name="id2839261"></a><pre class="programlisting">#define             G_END_DECLS</pre>
<p>
Used (along with <a class="link" href="glib-Miscellaneous-Macros.html#G-BEGIN-DECLS:CAPS"><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" lang="en">
<a name="id2839292"></a><h3>
<a name="G-N-ELEMENTS:CAPS"></a>G_N_ELEMENTS()</h3>
<a class="indexterm" name="id2839305"></a><pre class="programlisting">#define G_N_ELEMENTS(arr)		(sizeof (arr) / sizeof ((arr)[0]))
</pre>
<p>
Determines the number of elements in an array. The array must be
declared so the compiler knows its size at compile-time; this 
macro will not work on an array allocated on the heap, only static
arrays or arrays on the stack.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>arr</code></em>&#160;:</span></p></td>
<td>the array


</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2839342"></a><h3>
<a name="G-VA-COPY:CAPS"></a>G_VA_COPY()</h3>
<a class="indexterm" name="id2839355"></a><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"><code class="function">memmove()</code></code> and GLib 
does not include <code class="function">string.h</code> for you.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>ap1</code></em>&#160;:</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>&#160;:</span></p></td>
<td>a <span class="type">va_list</span>.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2839451"></a><h3>
<a name="G-STRINGIFY:CAPS"></a>G_STRINGIFY()</h3>
<a class="indexterm" name="id2839463"></a><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.
</p>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>macro_or_string</code></em>&#160;:</span></p></td>
<td>a macro or a string.


</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2839499"></a><h3>
<a name="G-GNUC-EXTENSION:CAPS"></a>G_GNUC_EXTENSION</h3>
<a class="indexterm" name="id2839513"></a><pre class="programlisting">#define             G_GNUC_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" lang="en">
<a name="id2839552"></a><h3>
<a name="G-GNUC-CONST:CAPS"></a>G_GNUC_CONST</h3>
<a class="indexterm" name="id2839564"></a><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. See the GNU C documentation for details. 
</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>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2839607"></a><h3>
<a name="G-GNUC-PURE:CAPS"></a>G_GNUC_PURE</h3>
<a class="indexterm" name="id2839620"></a><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.
See the GNU C documentation for details. 
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2839652"></a><h3>
<a name="G-GNUC-MALLOC:CAPS"></a>G_GNUC_MALLOC</h3>
<a class="indexterm" name="id2839668"></a><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).  
See the GNU C documentation for details. 
</p>
<p class="since">Since 2.6


</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2839708"></a><h3>
<a name="G-GNUC-DEPRECATED:CAPS"></a>G_GNUC_DEPRECATED</h3>
<a class="indexterm" name="id2839724"></a><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</code> option, the compiler will 
generate warnings when deprecated interfaces are used.
See the GNU C documentation for details. 
</p>
<p class="since">Since 2.2


</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2839765"></a><h3>
<a name="G-GNUC-NORETURN:CAPS"></a>G_GNUC_NORETURN</h3>
<a class="indexterm" name="id2839779"></a><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. See the GNU C documentation for details. 
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2839810"></a><h3>
<a name="G-GNUC-UNUSED:CAPS"></a>G_GNUC_UNUSED</h3>
<a class="indexterm" name="id2839822"></a><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 which may never be used.
It avoids possible compiler warnings. See the GNU C documentation for details. 
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2839852"></a><h3>
<a name="G-GNUC-PRINTF:CAPS"></a>G_GNUC_PRINTF()</h3>
<a class="indexterm" name="id2839865"></a><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"><code class="function">printf()</code></code>.
It allows the compiler to type-check the arguments passed to the function.
See the GNU C documentation for details. 
</p>
<div class="informalexample"><pre class="programlisting">
gint g_snprintf (gchar  *string,
                 gulong       n,
                 gchar const *format,
                 ...) G_GNUC_PRINTF (3, 4);
</pre></div>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>format_idx</code></em>&#160;:</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>&#160;:</span></p></td>
<td>the index of the first of the format arguments.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2839956"></a><h3>
<a name="G-GNUC-SCANF:CAPS"></a>G_GNUC_SCANF()</h3>
<a class="indexterm" name="id2839968"></a><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"><code class="function">scanf()</code></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">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>format_idx</code></em>&#160;:</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>&#160;:</span></p></td>
<td>the index of the first of the format arguments.


</td>
</tr>
</tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2840049"></a><h3>
<a name="G-GNUC-FORMAT:CAPS"></a>G_GNUC_FORMAT()</h3>
<a class="indexterm" name="id2840062"></a><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"><code class="function">printf()</code></code>, <code class="function"><code class="function">scanf()</code></code>, 
<code class="function"><code class="function">strftime()</code></code> or <code class="function"><code class="function">strfmon()</code></code> style
function and modifies it, so that the result can be passed to a 
<code class="function"><code class="function">printf()</code></code>, <code class="function"><code class="function">scanf()</code></code>, 
<code class="function"><code class="function">strftime()</code></code> or <code class="function"><code class="function">strfmon()</code></code> style 
function (with the remaining arguments to the format function the same as 
they would have been for the unmodified string). 
See the GNU C documentation for details. 
</p>
<div class="informalexample"><pre class="programlisting">
gchar *g_dgettext (gchar *domain_name, gchar *msgid) G_GNUC_FORMAT (2);
</pre></div>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><em class="parameter"><code>arg_idx</code></em>&#160;:</span></p></td>
<td>the index of the argument.


</td>
</tr></tbody>
</table></div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2840232"></a><h3>
<a name="G-GNUC-NULL-TERMINATED:CAPS"></a>G_GNUC_NULL_TERMINATED</h3>
<a class="indexterm" name="id2840244"></a><pre class="programlisting">#define             G_GNUC_NULL_TERMINATED</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"><code class="literal">NULL</code></a>.
See the GNU C documentation for details. 
</p>

Since: 2.8</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2840288"></a><h3>
<a name="G-GNUC-WARN-UNUSED-RESULT:CAPS"></a>G_GNUC_WARN_UNUSED_RESULT</h3>
<a class="indexterm" name="id2840304"></a><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. See the GNU C documentation for details. 
</p>
<p class="since">Since 2.10


</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2840343"></a><h3>
<a name="G-GNUC-FUNCTION:CAPS"></a>G_GNUC_FUNCTION</h3>
<a class="indexterm" name="id2840357"></a><pre class="programlisting">#define             G_GNUC_FUNCTION</pre>
<p>
Expands to the GNU C <code class="literal">__FUNCTION__</code> variable if the 
compiler is <span class="command"><strong>gcc</strong></span>, or "" if it isn't. The GNU C 
<code class="literal">__FUNCTION__</code> variable contains the name of the 
current function. See the GNU C documentation for details. 
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2840392"></a><h3>
<a name="G-GNUC-PRETTY-FUNCTION:CAPS"></a>G_GNUC_PRETTY_FUNCTION</h3>
<a class="indexterm" name="id2840404"></a><pre class="programlisting">#define             G_GNUC_PRETTY_FUNCTION</pre>
<p>
Expands to the GNU C <code class="literal">__PRETTY_FUNCTION__</code> variable 
if the compiler is <span class="command"><strong>gcc</strong></span>, or "" if it isn't.
The GNU C <code class="literal">__PRETTY_FUNCTION__</code> variable contains the 
name of the current function. For a C program this is the same as the 
<code class="literal">__FUNCTION__</code> variable but for C++ it also includes 
extra information such as the class and function prototype. See the 
GNU C documentation for details. 
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2840449"></a><h3>
<a name="G-GNUC-NO-INSTRUMENT:CAPS"></a>G_GNUC_NO_INSTRUMENT</h3>
<a class="indexterm" name="id2840462"></a><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.
See the GNU C documentation for details. 
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2840497"></a><h3>
<a name="G-HAVE-GNUC-VISIBILITY:CAPS"></a>G_HAVE_GNUC_VISIBILITY</h3>
<a class="indexterm" name="id2840510"></a><pre class="programlisting">#define G_HAVE_GNUC_VISIBILITY 1
</pre>
<p>
This macro is defined as 1 if the the compiler supports ELF visibility 
attributes (currently only <span class="command"><strong>gcc</strong></span>).
</p>

Since: 2.6</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2840534"></a><h3>
<a name="G-GNUC-INTERNAL:CAPS"></a>G_GNUC_INTERNAL</h3>
<a class="indexterm" name="id2840548"></a><pre class="programlisting">#define             G_GNUC_INTERNAL</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>
<div class="informalexample"><pre class="programlisting">
G_GNUC_INTERNAL
void _g_log_fallback_handler (const gchar    *log_domain,
                              GLogLevelFlags  log_level,
                              const gchar    *message,
                              gpointer        unused_data);
</pre></div>

Since: 2.6</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2840605"></a><h3>
<a name="G-GNUC-MAY-ALIAS:CAPS"></a>G_GNUC_MAY_ALIAS</h3>
<a class="indexterm" name="id2840617"></a><pre class="programlisting">#define             G_GNUC_MAY_ALIAS</pre>
<p>

</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2840633"></a><h3>
<a name="G-LIKELY:CAPS"></a>G_LIKELY ()</h3>
<a class="indexterm" name="id2840647"></a><pre class="programlisting">if                  G_LIKELY                            ();</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>
<div class="informalexample"><pre class="programlisting">
if (G_LIKELY (random () != 1))
  g_print ("not one");
</pre></div>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody><tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</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" lang="en">
<a name="id2840705"></a><h3>
<a name="G-UNLIKELY:CAPS"></a>G_UNLIKELY()</h3>
<a class="indexterm" name="id2840720"></a><pre class="programlisting">#define             G_UNLIKELY(expr)</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>
<div class="informalexample"><pre class="programlisting">
if (G_UNLIKELY (random () == 1))
  g_print ("a random one");
</pre></div>
<div class="variablelist"><table border="0">
<col align="left" valign="top">
<tbody>
<tr>
<td><p><span class="term"><em class="parameter"><code>expr</code></em>&#160;:</span></p></td>
<td>the expression
</td>
</tr>
<tr>
<td><p><span class="term"><span class="emphasis"><em>Returns</em></span>&#160;:</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" lang="en">
<a name="id2840787"></a><h3>
<a name="G-STRLOC:CAPS"></a>G_STRLOC</h3>
<a class="indexterm" name="id2840799"></a><pre class="programlisting">#define             G_STRLOC</pre>
<p>
Expands to a string identifying the current code position. 
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2840815"></a><h3>
<a name="G-STRFUNC:CAPS"></a>G_STRFUNC</h3>
<a class="indexterm" name="id2840830"></a><pre class="programlisting">#define             G_STRFUNC</pre>
<p>
Expands to a string identifying the current function. 
</p>
<p class="since">Since 2.4


</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2840853"></a><h3>
<a name="G-GINT16-MODIFIER:CAPS"></a>G_GINT16_MODIFIER</h3>
<a class="indexterm" name="id2840869"></a><pre class="programlisting">#define G_GINT16_MODIFIER "h"
</pre>
<p>
The platform dependent length modifier for constructing <code class="function">printf()</code> conversion
specifiers for values of type <a class="link" href="glib-Basic-Types.html#gint16"><span class="type">gint16</span></a> or <a class="link" href="glib-Basic-Types.html#guint16"><span class="type">guint16</span></a>. It is a string literal, 
but doesn't include the percent-sign, such that you can add precision and 
length modifiers between percent-sign and conversion specifier and append a 
conversion specifier.
</p>
<p>
The following example prints "0x7b";
</p>
<div class="informalexample"><pre class="programlisting">
gint16 value = 123;
g_print ("%#" G_GINT16_MODIFIER "x", value);
</pre></div>
<p>
</p>
<p class="since">Since 2.4


</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2840936"></a><h3>
<a name="G-GINT16-FORMAT:CAPS"></a>G_GINT16_FORMAT</h3>
<a class="indexterm" name="id2840949"></a><pre class="programlisting">#define G_GINT16_FORMAT "hi"
</pre>
<p>
This is the platform dependent conversion specifier for scanning and
printing values of type <a class="link" href="glib-Basic-Types.html#gint16"><span class="type">gint16</span></a>. It is a string literal, but doesn't
include the percent-sign, such that you can add precision and length
modifiers between percent-sign and conversion specifier.
</p>
<p>
</p>
<div class="informalexample"><pre class="programlisting">
gint16 in;
gint32 out;
sscanf ("42", "%" G_GINT16_FORMAT, &amp;in)
out = in * 1000;
g_print ("%" G_GINT32_FORMAT, out);
</pre></div>
<p>
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2840991"></a><h3>
<a name="G-GUINT16-FORMAT:CAPS"></a>G_GUINT16_FORMAT</h3>
<a class="indexterm" name="id2841004"></a><pre class="programlisting">#define G_GUINT16_FORMAT "hu"
</pre>
<p>
This is the platform dependent conversion specifier for scanning and
printing values of type <a class="link" href="glib-Basic-Types.html#guint16"><span class="type">guint16</span></a>. See also <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT16-FORMAT:CAPS"><span class="type">G_GINT16_FORMAT</span></a>.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2841038"></a><h3>
<a name="G-GINT32-MODIFIER:CAPS"></a>G_GINT32_MODIFIER</h3>
<a class="indexterm" name="id2841053"></a><pre class="programlisting">#define G_GINT32_MODIFIER ""
</pre>
<p>
The platform dependent length modifier for constructing <code class="function">printf()</code> conversion
specifiers for values of type <a class="link" href="glib-Basic-Types.html#gint32"><span class="type">gint32</span></a> or <a class="link" href="glib-Basic-Types.html#guint32"><span class="type">guint32</span></a>. See also <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT16-MODIFIER:CAPS"><span class="type">G_GINT16_MODIFIER</span></a>.
</p>
<p class="since">Since 2.4


</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2841112"></a><h3>
<a name="G-GINT32-FORMAT:CAPS"></a>G_GINT32_FORMAT</h3>
<a class="indexterm" name="id2841124"></a><pre class="programlisting">#define G_GINT32_FORMAT "i"
</pre>
<p>
This is the platform dependent conversion specifier for scanning and
printing values of type <a class="link" href="glib-Basic-Types.html#gint32"><span class="type">gint32</span></a>. See also <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT16-FORMAT:CAPS"><span class="type">G_GINT16_FORMAT</span></a>.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2841158"></a><h3>
<a name="G-GUINT32-FORMAT:CAPS"></a>G_GUINT32_FORMAT</h3>
<a class="indexterm" name="id2841171"></a><pre class="programlisting">#define G_GUINT32_FORMAT "u"
</pre>
<p>
This is the platform dependent conversion specifier for scanning and
printing values of type <a class="link" href="glib-Basic-Types.html#guint32"><span class="type">guint32</span></a>. See also <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT16-FORMAT:CAPS"><span class="type">G_GINT16_FORMAT</span></a>.
</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2841204"></a><h3>
<a name="G-GINT64-MODIFIER:CAPS"></a>G_GINT64_MODIFIER</h3>
<a class="indexterm" name="id2841220"></a><pre class="programlisting">#define G_GINT64_MODIFIER "ll"
</pre>
<p>
The platform dependent length modifier for constructing <code class="function">printf()</code> conversion
specifiers for values of type <a class="link" href="glib-Basic-Types.html#gint64"><span class="type">gint64</span></a> or <a class="link" href="glib-Basic-Types.html#guint64"><span class="type">guint64</span></a>. See also <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT16-MODIFIER:CAPS"><span class="type">G_GINT16_MODIFIER</span></a>.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
<p>
Some platforms do not support printing 64 bit integers,
even though the types are supported. On such platforms <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT64-MODIFIER:CAPS"><span class="type">G_GINT64_MODIFIER</span></a>
is not defined.
</p>
</div>
<p class="since">Since 2.4


</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2841296"></a><h3>
<a name="G-GINT64-FORMAT:CAPS"></a>G_GINT64_FORMAT</h3>
<a class="indexterm" name="id2841309"></a><pre class="programlisting">#define G_GINT64_FORMAT "lli"
</pre>
<p>
This is the platform dependent conversion specifier for scanning and
printing values of type <a class="link" href="glib-Basic-Types.html#gint64"><span class="type">gint64</span></a>. See also <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT16-FORMAT:CAPS"><span class="type">G_GINT16_FORMAT</span></a>.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
<p>
Some platforms do not support scanning and printing 64 bit integers,
even though the types are supported. On such platforms <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT64-FORMAT:CAPS"><span class="type">G_GINT64_FORMAT</span></a>
is not defined. Note that <code class="function">scanf()</code> may not support 64 bit integers, even
if <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT64-FORMAT:CAPS"><span class="type">G_GINT64_FORMAT</span></a> is defined. Due to its weak error handling, <code class="function">scanf()</code> is not 
recommended for parsing anyway; consider using <code class="function">g_strtoull()</code> instead.
</p>
</div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2841402"></a><h3>
<a name="G-GUINT64-FORMAT:CAPS"></a>G_GUINT64_FORMAT</h3>
<a class="indexterm" name="id2841416"></a><pre class="programlisting">#define G_GUINT64_FORMAT "llu"
</pre>
<p>
This is the platform dependent conversion specifier for scanning and
printing values of type <a class="link" href="glib-Basic-Types.html#guint64"><span class="type">guint64</span></a>. See also <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT16-FORMAT:CAPS"><span class="type">G_GINT16_FORMAT</span></a>.
</p>
<div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
<h3 class="title">Note</h3>
<p>
Some platforms do not support scanning and printing 64 bit integers,
even though the types are supported. On such platforms <a class="link" href="glib-Miscellaneous-Macros.html#G-GUINT64-FORMAT:CAPS"><span class="type">G_GUINT64_FORMAT</span></a>
is not defined.  Note that <code class="function">scanf()</code> may not support 64 bit integers, even
if <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT64-FORMAT:CAPS"><span class="type">G_GINT64_FORMAT</span></a> is defined. Due to its weak error handling, <code class="function">scanf()</code> is not 
recommended for parsing anyway; consider using <code class="function">g_strtoull()</code> instead.
</p>
</div>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2841508"></a><h3>
<a name="G-GSIZE-MODIFIER:CAPS"></a>G_GSIZE_MODIFIER</h3>
<a class="indexterm" name="id2841523"></a><pre class="programlisting">#define G_GSIZE_MODIFIER ""
</pre>
<p>
The platform dependent length modifier for constructing <code class="function">printf()</code> conversion
specifiers for values of type <a class="link" href="glib-Basic-Types.html#gsize"><span class="type">gsize</span></a> or <a class="link" href="glib-Basic-Types.html#gssize"><span class="type">gssize</span></a>. See also <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT16-MODIFIER:CAPS"><span class="type">G_GINT16_MODIFIER</span></a>.
</p>
<p class="since">Since 2.6


</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2841582"></a><h3>
<a name="G-GSIZE-FORMAT:CAPS"></a>G_GSIZE_FORMAT</h3>
<a class="indexterm" name="id2841596"></a><pre class="programlisting">#define G_GSIZE_FORMAT "u"
</pre>
<p>
This is the platform dependent conversion specifier for scanning and
printing values of type <a class="link" href="glib-Basic-Types.html#gsize"><span class="type">gsize</span></a>. See also <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT16-FORMAT:CAPS"><span class="type">G_GINT16_FORMAT</span></a>.
</p>
<p class="since">Since 2.6


</p>
</div>
<hr>
<div class="refsect2" lang="en">
<a name="id2841637"></a><h3>
<a name="G-GSSIZE-FORMAT:CAPS"></a>G_GSSIZE_FORMAT</h3>
<a class="indexterm" name="id2841652"></a><pre class="programlisting">#define G_GSSIZE_FORMAT "i"
</pre>
<p>
This is the platform dependent conversion specifier for scanning and
printing values of type <a class="link" href="glib-Basic-Types.html#gssize"><span class="type">gssize</span></a>. See also <a class="link" href="glib-Miscellaneous-Macros.html#G-GINT16-FORMAT:CAPS"><span class="type">G_GINT16_FORMAT</span></a>.
</p>
<p class="since">Since 2.6


</p>
</div>
</div>
<div class="refsect1" lang="en">
<a name="id2841694"></a><div class="refsect2" lang="en"><a name="id2841695"></a></div>
<hr>
<div class="refsect2" lang="en"><a name="id2841696"></a></div>
</div>
</div>
</body>
</html>