[gnome-devel-docs] Start reviving the Gnome Programming Guidelines



commit cf1ad740169eddc973c3ea97ccfa513cb674e7db
Author: Federico Mena Quintero <federico gnome org>
Date:   Mon Aug 5 15:49:53 2013 +0200

    Start reviving the Gnome Programming Guidelines

 programming-guidelines/C/README                    |   10 +
 .../C/old-programming-guidelines.ps                | 1601 ++++++++++++++++++++
 2 files changed, 1611 insertions(+), 0 deletions(-)
---
diff --git a/programming-guidelines/C/README b/programming-guidelines/C/README
new file mode 100644
index 0000000..b3f2f1f
--- /dev/null
+++ b/programming-guidelines/C/README
@@ -0,0 +1,10 @@
+This is the Gnome Programming Guidelines, a style guide for writing
+code for Gnome, and things we have learned over the years that make
+the Gnome project easier to follow.
+
+The original Programming Guidelines document is included, for
+nostalgia, as old-programming-guidelines.ps - I couldn't find the
+original sources in a friendlier format.
+
+Federico Mena Quintero <federico gnome org>
+August 2013
diff --git a/programming-guidelines/C/old-programming-guidelines.ps 
b/programming-guidelines/C/old-programming-guidelines.ps
new file mode 100644
index 0000000..1bdb694
--- /dev/null
+++ b/programming-guidelines/C/old-programming-guidelines.ps
@@ -0,0 +1,1601 @@
+%!PS-Adobe-2.0
+%%Creator: dvips(k) 5.86 Copyright 1999 Radical Eye Software
+%%Title: programming-guidelines.dvi
+%%Pages: 20
+%%PageOrder: Ascend
+%%BoundingBox: 0 0 596 842
+%%DocumentFonts: Helvetica-Bold Palatino-Roman Courier Palatino-Italic
+%%+ Palatino-Bold Courier-Bold Courier-Oblique
+%%EndComments
+%DVIPSWebPage: (www.radicaleye.com)
+%DVIPSCommandLine: dvips programming-guidelines.dvi -o
+%+ programming-guidelines.ps
+%DVIPSParameters: dpi=600, compressed
+%DVIPSSource:  TeX output 1999.10.29:1425
+%%BeginProcSet: texc.pro
+%!
+/TeXDict 300 dict def TeXDict begin/N{def}def/B{bind def}N/S{exch}N/X{S
+N}B/A{dup}B/TR{translate}N/isls false N/vsize 11 72 mul N/hsize 8.5 72
+mul N/landplus90{false}def/@rigin{isls{[0 landplus90{1 -1}{-1 1}ifelse 0
+0 0]concat}if 72 Resolution div 72 VResolution div neg scale isls{
+landplus90{VResolution 72 div vsize mul 0 exch}{Resolution -72 div hsize
+mul 0}ifelse TR}if Resolution VResolution vsize -72 div 1 add mul TR[
+matrix currentmatrix{A A round sub abs 0.00001 lt{round}if}forall round
+exch round exch]setmatrix}N/@landscape{/isls true N}B/@manualfeed{
+statusdict/manualfeed true put}B/@copies{/#copies X}B/FMat[1 0 0 -1 0 0]
+N/FBB[0 0 0 0]N/nn 0 N/IEn 0 N/ctr 0 N/df-tail{/nn 8 dict N nn begin
+/FontType 3 N/FontMatrix fntrx N/FontBBox FBB N string/base X array
+/BitMaps X/BuildChar{CharBuilder}N/Encoding IEn N end A{/foo setfont}2
+array copy cvx N load 0 nn put/ctr 0 N[}B/sf 0 N/df{/sf 1 N/fntrx FMat N
+df-tail}B/dfs{div/sf X/fntrx[sf 0 0 sf neg 0 0]N df-tail}B/E{pop nn A
+definefont setfont}B/Cw{Cd A length 5 sub get}B/Ch{Cd A length 4 sub get
+}B/Cx{128 Cd A length 3 sub get sub}B/Cy{Cd A length 2 sub get 127 sub}
+B/Cdx{Cd A length 1 sub get}B/Ci{Cd A type/stringtype ne{ctr get/ctr ctr
+1 add N}if}B/id 0 N/rw 0 N/rc 0 N/gp 0 N/cp 0 N/G 0 N/CharBuilder{save 3
+1 roll S A/base get 2 index get S/BitMaps get S get/Cd X pop/ctr 0 N Cdx
+0 Cx Cy Ch sub Cx Cw add Cy setcachedevice Cw Ch true[1 0 0 -1 -.1 Cx
+sub Cy .1 sub]/id Ci N/rw Cw 7 add 8 idiv string N/rc 0 N/gp 0 N/cp 0 N{
+rc 0 ne{rc 1 sub/rc X rw}{G}ifelse}imagemask restore}B/G{{id gp get/gp
+gp 1 add N A 18 mod S 18 idiv pl S get exec}loop}B/adv{cp add/cp X}B
+/chg{rw cp id gp 4 index getinterval putinterval A gp add/gp X adv}B/nd{
+/cp 0 N rw exit}B/lsh{rw cp 2 copy get A 0 eq{pop 1}{A 255 eq{pop 254}{
+A A add 255 and S 1 and or}ifelse}ifelse put 1 adv}B/rsh{rw cp 2 copy
+get A 0 eq{pop 128}{A 255 eq{pop 127}{A 2 idiv S 128 and or}ifelse}
+ifelse put 1 adv}B/clr{rw cp 2 index string putinterval adv}B/set{rw cp
+fillstr 0 4 index getinterval putinterval adv}B/fillstr 18 string 0 1 17
+{2 copy 255 put pop}for N/pl[{adv 1 chg}{adv 1 chg nd}{1 add chg}{1 add
+chg nd}{adv lsh}{adv lsh nd}{adv rsh}{adv rsh nd}{1 add adv}{/rc X nd}{
+1 add set}{1 add clr}{adv 2 chg}{adv 2 chg nd}{pop nd}]A{bind pop}
+forall N/D{/cc X A type/stringtype ne{]}if nn/base get cc ctr put nn
+/BitMaps get S ctr S sf 1 ne{A A length 1 sub A 2 index S get sf div put
+}if put/ctr ctr 1 add N}B/I{cc 1 add D}B/bop{userdict/bop-hook known{
+bop-hook}if/SI save N @rigin 0 0 moveto/V matrix currentmatrix A 1 get A
+mul exch 0 get A mul add .99 lt{/QV}{/RV}ifelse load def pop pop}N/eop{
+SI restore userdict/eop-hook known{eop-hook}if showpage}N/@start{
+userdict/start-hook known{start-hook}if pop/VResolution X/Resolution X
+1000 div/DVImag X/IEn 256 array N 2 string 0 1 255{IEn S A 360 add 36 4
+index cvrs cvn put}for pop 65781.76 div/vsize X 65781.76 div/hsize X}N
+/p{show}N/RMat[1 0 0 -1 0 0]N/BDot 260 string N/Rx 0 N/Ry 0 N/V{}B/RV/v{
+/Ry X/Rx X V}B statusdict begin/product where{pop false[(Display)(NeXT)
+(LaserWriter 16/600)]{A length product length le{A length product exch 0
+exch getinterval eq{pop true exit}if}{pop}ifelse}forall}{false}ifelse
+end{{gsave TR -.1 .1 TR 1 1 scale Rx Ry false RMat{BDot}imagemask
+grestore}}{{gsave TR -.1 .1 TR Rx Ry scale 1 1 false RMat{BDot}
+imagemask grestore}}ifelse B/QV{gsave newpath transform round exch round
+exch itransform moveto Rx 0 rlineto 0 Ry neg rlineto Rx neg 0 rlineto
+fill grestore}B/a{moveto}B/delta 0 N/tail{A/delta X 0 rmoveto}B/M{S p
+delta add tail}B/b{S p tail}B/c{-4 M}B/d{-3 M}B/e{-2 M}B/f{-1 M}B/g{0 M}
+B/h{1 M}B/i{2 M}B/j{3 M}B/k{4 M}B/w{0 rmoveto}B/l{p -4 w}B/m{p -3 w}B/n{
+p -2 w}B/o{p -1 w}B/q{p 1 w}B/r{p 2 w}B/s{p 3 w}B/t{p 4 w}B/x{0 S
+rmoveto}B/y{3 2 roll p a}B/bos{/SS save N}B/eos{SS restore}B end
+
+%%EndProcSet
+%%BeginProcSet: 8r.enc
+% @@psencodingfile {
+%   author = "S. Rahtz, P. MacKay, Alan Jeffrey, B. Horn, K. Berry",
+%   version = "0.6",
+%   date = "1 July 1998",
+%   filename = "8r.enc",
+%   email = "tex-fonts@@tug.org",
+%   docstring = "Encoding for TrueType or Type 1 fonts
+%                to be used with TeX."
+% @}
+% 
+% Idea is to have all the characters normally included in Type 1 fonts
+% available for typesetting. This is effectively the characters in Adobe
+% Standard Encoding + ISO Latin 1 + extra characters from Lucida.
+% 
+% Character code assignments were made as follows:
+% 
+% (1) the Windows ANSI characters are almost all in their Windows ANSI
+% positions, because some Windows users cannot easily reencode the
+% fonts, and it makes no difference on other systems. The only Windows
+% ANSI characters not available are those that make no sense for
+% typesetting -- rubout (127 decimal), nobreakspace (160), softhyphen
+% (173). quotesingle and grave are moved just because it's such an
+% irritation not having them in TeX positions.
+% 
+% (2) Remaining characters are assigned arbitrarily to the lower part
+% of the range, avoiding 0, 10 and 13 in case we meet dumb software.
+% 
+% (3) Y&Y Lucida Bright includes some extra text characters; in the
+% hopes that other PostScript fonts, perhaps created for public
+% consumption, will include them, they are included starting at 0x12.
+% 
+% (4) Remaining positions left undefined are for use in (hopefully)
+% upward-compatible revisions, if someday more characters are generally
+% available.
+% 
+% (5) hyphen appears twice for compatibility with both 
+% ASCII and Windows.
+% 
+/TeXBase1Encoding [
+% 0x00 (encoded characters from Adobe Standard not in Windows 3.1)
+  /.notdef /dotaccent /fi /fl
+  /fraction /hungarumlaut /Lslash /lslash
+  /ogonek /ring /.notdef
+  /breve /minus /.notdef 
+% These are the only two remaining unencoded characters, so may as
+% well include them.
+  /Zcaron /zcaron 
+% 0x10
+ /caron /dotlessi 
+% (unusual TeX characters available in, e.g., Lucida Bright)
+ /dotlessj /ff /ffi /ffl 
+ /.notdef /.notdef /.notdef /.notdef
+ /.notdef /.notdef /.notdef /.notdef
+ % very contentious; it's so painful not having quoteleft and quoteright
+ % at 96 and 145 that we move the things normally found there to here.
+ /grave /quotesingle 
+% 0x20 (ASCII begins)
+ /space /exclam /quotedbl /numbersign
+ /dollar /percent /ampersand /quoteright
+ /parenleft /parenright /asterisk /plus /comma /hyphen /period /slash
+% 0x30
+ /zero /one /two /three /four /five /six /seven
+ /eight /nine /colon /semicolon /less /equal /greater /question
+% 0x40
+ /at /A /B /C /D /E /F /G /H /I /J /K /L /M /N /O
+% 0x50
+ /P /Q /R /S /T /U /V /W
+ /X /Y /Z /bracketleft /backslash /bracketright /asciicircum /underscore
+% 0x60
+ /quoteleft /a /b /c /d /e /f /g /h /i /j /k /l /m /n /o
+% 0x70
+ /p /q /r /s /t /u /v /w
+ /x /y /z /braceleft /bar /braceright /asciitilde
+ /.notdef % rubout; ASCII ends
+% 0x80
+ /.notdef /.notdef /quotesinglbase /florin
+ /quotedblbase /ellipsis /dagger /daggerdbl
+ /circumflex /perthousand /Scaron /guilsinglleft
+ /OE /.notdef /.notdef /.notdef
+% 0x90
+ /.notdef /.notdef /.notdef /quotedblleft
+ /quotedblright /bullet /endash /emdash
+ /tilde /trademark /scaron /guilsinglright
+ /oe /.notdef /.notdef /Ydieresis
+% 0xA0
+ /.notdef % nobreakspace
+ /exclamdown /cent /sterling
+ /currency /yen /brokenbar /section
+ /dieresis /copyright /ordfeminine /guillemotleft
+ /logicalnot
+ /hyphen % Y&Y (also at 45); Windows' softhyphen
+ /registered
+ /macron
+% 0xD0
+ /degree /plusminus /twosuperior /threesuperior
+ /acute /mu /paragraph /periodcentered
+ /cedilla /onesuperior /ordmasculine /guillemotright
+ /onequarter /onehalf /threequarters /questiondown
+% 0xC0
+ /Agrave /Aacute /Acircumflex /Atilde /Adieresis /Aring /AE /Ccedilla
+ /Egrave /Eacute /Ecircumflex /Edieresis
+ /Igrave /Iacute /Icircumflex /Idieresis
+% 0xD0
+ /Eth /Ntilde /Ograve /Oacute
+ /Ocircumflex /Otilde /Odieresis /multiply
+ /Oslash /Ugrave /Uacute /Ucircumflex
+ /Udieresis /Yacute /Thorn /germandbls
+% 0xE0
+ /agrave /aacute /acircumflex /atilde
+ /adieresis /aring /ae /ccedilla
+ /egrave /eacute /ecircumflex /edieresis
+ /igrave /iacute /icircumflex /idieresis
+% 0xF0
+ /eth /ntilde /ograve /oacute
+ /ocircumflex /otilde /odieresis /divide
+ /oslash /ugrave /uacute /ucircumflex
+ /udieresis /yacute /thorn /ydieresis
+] def
+
+%%EndProcSet
+%%BeginProcSet: texps.pro
+%!
+TeXDict begin/rf{findfont dup length 1 add dict begin{1 index/FID ne 2
+index/UniqueID ne and{def}{pop pop}ifelse}forall[1 index 0 6 -1 roll
+exec 0 exch 5 -1 roll VResolution Resolution div mul neg 0 0]/Metrics
+exch def dict begin Encoding{exch dup type/integertype ne{pop pop 1 sub
+dup 0 le{pop}{[}ifelse}{FontMatrix 0 get div Metrics 0 get div def}
+ifelse}forall Metrics/Metrics currentdict end def[2 index currentdict
+end definefont 3 -1 roll makefont/setfont cvx]cvx def}def/ObliqueSlant{
+dup sin S cos div neg}B/SlantFont{4 index mul add}def/ExtendFont{3 -1
+roll mul exch}def/ReEncodeFont{CharStrings rcheck{/Encoding false def
+dup[exch{dup CharStrings exch known not{pop/.notdef/Encoding true def}
+if}forall Encoding{]exch pop}{cleartomark}ifelse}if/Encoding exch def}
+def end
+
+%%EndProcSet
+%%BeginProcSet: special.pro
+%!
+TeXDict begin/SDict 200 dict N SDict begin/@SpecialDefaults{/hs 612 N
+/vs 792 N/ho 0 N/vo 0 N/hsc 1 N/vsc 1 N/ang 0 N/CLIP 0 N/rwiSeen false N
+/rhiSeen false N/letter{}N/note{}N/a4{}N/legal{}N}B/@scaleunit 100 N
+/@hscale{ scaleunit div/hsc X}B/@vscale{ scaleunit div/vsc X}B/@hsize{
+/hs X/CLIP 1 N}B/@vsize{/vs X/CLIP 1 N}B/@clip{/CLIP 2 N}B/@hoffset{/ho
+X}B/@voffset{/vo X}B/@angle{/ang X}B/@rwi{10 div/rwi X/rwiSeen true N}B
+/@rhi{10 div/rhi X/rhiSeen true N}B/@llx{/llx X}B/@lly{/lly X}B/@urx{
+/urx X}B/@ury{/ury X}B/magscale true def end/@MacSetUp{userdict/md known
+{userdict/md get type/dicttype eq{userdict begin md length 10 add md
+maxlength ge{/md md dup length 20 add dict copy def}if end md begin
+/letter{}N/note{}N/legal{}N/od{txpose 1 0 mtx defaultmatrix dtransform S
+atan/pa X newpath clippath mark{transform{itransform moveto}}{transform{
+itransform lineto}}{6 -2 roll transform 6 -2 roll transform 6 -2 roll
+transform{itransform 6 2 roll itransform 6 2 roll itransform 6 2 roll
+curveto}}{{closepath}}pathforall newpath counttomark array astore/gc xdf
+pop ct 39 0 put 10 fz 0 fs 2 F/|______Courier fnt invertflag{PaintBlack}
+if}N/txpose{pxs pys scale ppr aload pop por{noflips{pop S neg S TR pop 1
+-1 scale}if xflip yflip and{pop S neg S TR 180 rotate 1 -1 scale ppr 3
+get ppr 1 get neg sub neg ppr 2 get ppr 0 get neg sub neg TR}if xflip
+yflip not and{pop S neg S TR pop 180 rotate ppr 3 get ppr 1 get neg sub
+neg 0 TR}if yflip xflip not and{ppr 1 get neg ppr 0 get neg TR}if}{
+noflips{TR pop pop 270 rotate 1 -1 scale}if xflip yflip and{TR pop pop
+90 rotate 1 -1 scale ppr 3 get ppr 1 get neg sub neg ppr 2 get ppr 0 get
+neg sub neg TR}if xflip yflip not and{TR pop pop 90 rotate ppr 3 get ppr
+1 get neg sub neg 0 TR}if yflip xflip not and{TR pop pop 270 rotate ppr
+2 get ppr 0 get neg sub neg 0 S TR}if}ifelse scaleby96{ppr aload pop 4
+-1 roll add 2 div 3 1 roll add 2 div 2 copy TR .96 dup scale neg S neg S
+TR}if}N/cp{pop pop showpage pm restore}N end}if}if}N/normalscale{
+Resolution 72 div VResolution 72 div neg scale magscale{DVImag dup scale
+}if 0 setgray}N/psfts{S 65781.76 div N}N/startTexFig{/psf$SavedState
+save N userdict maxlength dict begin/magscale true def normalscale
+currentpoint TR/psf$ury psfts/psf$urx psfts/psf$lly psfts/psf$llx psfts
+/psf$y psfts/psf$x psfts currentpoint/psf$cy X/psf$cx X/psf$sx psf$x
+psf$urx psf$llx sub div N/psf$sy psf$y psf$ury psf$lly sub div N psf$sx
+psf$sy scale psf$cx psf$sx div psf$llx sub psf$cy psf$sy div psf$ury sub
+TR/showpage{}N/erasepage{}N/copypage{}N/p 3 def @MacSetUp}N/doclip{
+psf$llx psf$lly psf$urx psf$ury currentpoint 6 2 roll newpath 4 copy 4 2
+roll moveto 6 -1 roll S lineto S lineto S lineto closepath clip newpath
+moveto}N/endTexFig{end psf$SavedState restore}N/@beginspecial{SDict
+begin/SpecialSave save N gsave normalscale currentpoint TR
+ SpecialDefaults count/ocount X/dcount countdictstack N}N/@setspecial{
+CLIP 1 eq{newpath 0 0 moveto hs 0 rlineto 0 vs rlineto hs neg 0 rlineto
+closepath clip}if ho vo TR hsc vsc scale ang rotate rwiSeen{rwi urx llx
+sub div rhiSeen{rhi ury lly sub div}{dup}ifelse scale llx neg lly neg TR
+}{rhiSeen{rhi ury lly sub div dup scale llx neg lly neg TR}if}ifelse
+CLIP 2 eq{newpath llx lly moveto urx lly lineto urx ury lineto llx ury
+lineto closepath clip}if/showpage{}N/erasepage{}N/copypage{}N newpath}N
+/@endspecial{count ocount sub{pop}repeat countdictstack dcount sub{end}
+repeat grestore SpecialSave restore end}N/@defspecial{SDict begin}N
+/@fedspecial{end}B/li{lineto}B/rl{rlineto}B/rc{rcurveto}B/np{/SaveX
+currentpoint/SaveY X N 1 setlinecap newpath}N/st{stroke SaveX SaveY
+moveto}N/fil{fill SaveX SaveY moveto}N/ellipse{/endangle X/startangle X
+/yrad X/xrad X/savematrix matrix currentmatrix N TR xrad yrad scale 0 0
+1 startangle endangle arc savematrix setmatrix}N end
+
+%%EndProcSet
+%%BeginProcSet: color.pro
+%!
+TeXDict begin/setcmykcolor where{pop}{/setcmykcolor{dup 10 eq{pop
+setrgbcolor}{1 sub 4 1 roll 3{3 index add neg dup 0 lt{pop 0}if 3 1 roll
+}repeat setrgbcolor pop}ifelse}B}ifelse/TeXcolorcmyk{setcmykcolor}def
+/TeXcolorrgb{setrgbcolor}def/TeXcolorgrey{setgray}def/TeXcolorgray{
+setgray}def/TeXcolorhsb{sethsbcolor}def/currentcmykcolor where{pop}{
+/currentcmykcolor{currentrgbcolor 10}B}ifelse/DC{exch dup userdict exch
+known{pop pop}{X}ifelse}B/GreenYellow{0.15 0 0.69 0 setcmykcolor}DC
+/Yellow{0 0 1 0 setcmykcolor}DC/Goldenrod{0 0.10 0.84 0 setcmykcolor}DC
+/Dandelion{0 0.29 0.84 0 setcmykcolor}DC/Apricot{0 0.32 0.52 0
+setcmykcolor}DC/Peach{0 0.50 0.70 0 setcmykcolor}DC/Melon{0 0.46 0.50 0
+setcmykcolor}DC/YellowOrange{0 0.42 1 0 setcmykcolor}DC/Orange{0 0.61
+0.87 0 setcmykcolor}DC/BurntOrange{0 0.51 1 0 setcmykcolor}DC
+/Bittersweet{0 0.75 1 0.24 setcmykcolor}DC/RedOrange{0 0.77 0.87 0
+setcmykcolor}DC/Mahogany{0 0.85 0.87 0.35 setcmykcolor}DC/Maroon{0 0.87
+0.68 0.32 setcmykcolor}DC/BrickRed{0 0.89 0.94 0.28 setcmykcolor}DC/Red{
+0 1 1 0 setcmykcolor}DC/OrangeRed{0 1 0.50 0 setcmykcolor}DC/RubineRed{
+0 1 0.13 0 setcmykcolor}DC/WildStrawberry{0 0.96 0.39 0 setcmykcolor}DC
+/Salmon{0 0.53 0.38 0 setcmykcolor}DC/CarnationPink{0 0.63 0 0
+setcmykcolor}DC/Magenta{0 1 0 0 setcmykcolor}DC/VioletRed{0 0.81 0 0
+setcmykcolor}DC/Rhodamine{0 0.82 0 0 setcmykcolor}DC/Mulberry{0.34 0.90
+0 0.02 setcmykcolor}DC/RedViolet{0.07 0.90 0 0.34 setcmykcolor}DC
+/Fuchsia{0.47 0.91 0 0.08 setcmykcolor}DC/Lavender{0 0.48 0 0
+setcmykcolor}DC/Thistle{0.12 0.59 0 0 setcmykcolor}DC/Orchid{0.32 0.64 0
+0 setcmykcolor}DC/DarkOrchid{0.40 0.80 0.20 0 setcmykcolor}DC/Purple{
+0.45 0.86 0 0 setcmykcolor}DC/Plum{0.50 1 0 0 setcmykcolor}DC/Violet{
+0.79 0.88 0 0 setcmykcolor}DC/RoyalPurple{0.75 0.90 0 0 setcmykcolor}DC
+/BlueViolet{0.86 0.91 0 0.04 setcmykcolor}DC/Periwinkle{0.57 0.55 0 0
+setcmykcolor}DC/CadetBlue{0.62 0.57 0.23 0 setcmykcolor}DC
+/CornflowerBlue{0.65 0.13 0 0 setcmykcolor}DC/MidnightBlue{0.98 0.13 0
+0.43 setcmykcolor}DC/NavyBlue{0.94 0.54 0 0 setcmykcolor}DC/RoyalBlue{1
+0.50 0 0 setcmykcolor}DC/Blue{1 1 0 0 setcmykcolor}DC/Cerulean{0.94 0.11
+0 0 setcmykcolor}DC/Cyan{1 0 0 0 setcmykcolor}DC/ProcessBlue{0.96 0 0 0
+setcmykcolor}DC/SkyBlue{0.62 0 0.12 0 setcmykcolor}DC/Turquoise{0.85 0
+0.20 0 setcmykcolor}DC/TealBlue{0.86 0 0.34 0.02 setcmykcolor}DC
+/Aquamarine{0.82 0 0.30 0 setcmykcolor}DC/BlueGreen{0.85 0 0.33 0
+setcmykcolor}DC/Emerald{1 0 0.50 0 setcmykcolor}DC/JungleGreen{0.99 0
+0.52 0 setcmykcolor}DC/SeaGreen{0.69 0 0.50 0 setcmykcolor}DC/Green{1 0
+1 0 setcmykcolor}DC/ForestGreen{0.91 0 0.88 0.12 setcmykcolor}DC
+/PineGreen{0.92 0 0.59 0.25 setcmykcolor}DC/LimeGreen{0.50 0 1 0
+setcmykcolor}DC/YellowGreen{0.44 0 0.74 0 setcmykcolor}DC/SpringGreen{
+0.26 0 0.76 0 setcmykcolor}DC/OliveGreen{0.64 0 0.95 0.40 setcmykcolor}
+DC/RawSienna{0 0.72 1 0.45 setcmykcolor}DC/Sepia{0 0.83 1 0.70
+setcmykcolor}DC/Brown{0 0.81 1 0.60 setcmykcolor}DC/Tan{0.14 0.42 0.56 0
+setcmykcolor}DC/Gray{0 0 0 0.50 setcmykcolor}DC/Black{0 0 0 1
+setcmykcolor}DC/White{0 0 0 0 setcmykcolor}DC end
+
+%%EndProcSet
+TeXDict begin 39158280 55380996 1000 600 600
+(programming-guidelines.dvi) @start /Fa 106[36 149[{
+TeXBase1Encoding ReEncodeFont}1 59.7758 /Palatino-Roman
+rf
+%DVIPSBitmapFont: Fb cmmi9 9 2
+/Fb 2 63 df<171C177EEE01FEEE07FCEE1FF0EE7FC0923801FF00ED07FCED1FF0ED7FC0
+4A48C7FCEC07FCEC1FF0EC7FC04948C8FCEB07FCEB1FF0EB7FC04848C9FCEA07FCEA1FF0
+EA7FC048CAFCA2EA7FC0EA1FF0EA07FCEA01FF38007FC0EB1FF0EB07FCEB01FF9038007F
+C0EC1FF0EC07FCEC01FF9138007FC0ED1FF0ED07FCED01FF9238007FC0EE1FF0EE07FCEE
+01FEEE007E171C2F2E7AA93C>60 D<127012FCB4FCEA7FC0EA1FF0EA07FCEA01FF38007F
+C0EB1FF0EB07FCEB01FF9038007FC0EC1FF0EC07FCEC01FF9138007FC0ED1FF0ED07FCED
+01FF9238007FC0EE1FF0EE07FCEE01FEA2EE07FCEE1FF0EE7FC0923801FF00ED07FCED1F
+F0ED7FC04A48C7FCEC07FCEC1FF0EC7FC04948C8FCEB07FCEB1FF0EB7FC04848C9FCEA07
+FCEA1FF0EA7FC048CAFC12FC12702F2E7AA93C>62 D E
+%EndDVIPSBitmapFont
+/Fc 137[50 1[50 1[50 1[50 6[50 3[50 3[50 97[{
+TeXBase1Encoding ReEncodeFont}7 83.022 /Courier-Oblique
+rf /Fd 137[45 1[45 1[45 1[45 45 45 45 3[45 45 45 45 45
+1[45 45 45 50[45 45 45[{TeXBase1Encoding ReEncodeFont}17
+74.7198 /Courier-Bold rf /Fe 139[28 46 3[51 51 74 23
+2[23 3[46 3[46 26[51 2[60 67[{TeXBase1Encoding ReEncodeFont}11
+83.022 /Helvetica-Bold rf /Ff 135[42 69 1[51 28 37 32
+1[51 46 51 74 28 51 1[28 51 46 1[42 51 37 51 42 12[55
+51 2[51 6[32 1[69 46 51 3[65 13[42 42 42 2[21 46[{
+TeXBase1Encoding ReEncodeFont}32 83.022 /Palatino-Bold
+rf /Fg 205[25 50[{TeXBase1Encoding ReEncodeFont}1 49.8132
+/Palatino-Roman rf /Fh 106[40 149[{TeXBase1Encoding ReEncodeFont}1
+66.4176 /Palatino-Roman rf /Fi 134[66 66 1[66 73 40 66
+47 73 1[73 73 106 33 66 1[33 73 73 40 66 73 66 73 66
+7[80 2[80 86 73 80 2[80 1[86 100 73 86 1[33 1[93 73 80
+86 86 86 86 18[33 40 1[70 43[{TeXBase1Encoding ReEncodeFont}43
+119.552 /Helvetica-Bold rf /Fj 134[42 42 60 42 46 28
+32 32 1[42 37 46 65 23 2[23 42 42 23 32 42 34 38 37 11[65
+2[55 1[51 65 65 78 5[60 46 51 65 1[51 8[42 42 42 42 42
+42 42 42 42 42 1[21 28 21 4[23 39[{TeXBase1Encoding ReEncodeFont}47
+83.022 /Palatino-Italic rf /Fk 84[45 44[45 45 45 45 45
+45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45
+45 45 45 45 45 45 45 1[45 1[45 1[45 1[45 45 45 45 45
+45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45 45
+45 45 45 45 45 45 1[45 45 45 45 1[45 1[45 45 45 45 45
+45 45 45 45 45 45 45 45 45 45 45 1[45 45 45 33[{
+TeXBase1Encoding ReEncodeFont}87 74.7198 /Courier rf
+/Fl 104[83 42 1[42 42 24[42 46 43 69 47 50 27 35 33 46
+50 45 48 73 24 46 19 24 48 46 28 40 51 37 46 42 23 42
+5[55 55 83 60 65 51 44 55 1[50 65 69 79 51 60 1[28 69
+63 46 51 64 59 51 65 1[37 50 1[50 21 21 1[42 1[42 42
+42 2[42 42 50 21 28 21 50 32 28 28 23 1[70 2[31 23 29[50
+50 2[{TeXBase1Encoding ReEncodeFont}80 83.022 /Palatino-Roman
+rf /Fm 134[55 55 2[61 33 55 39 1[61 61 61 89 28 55 1[28
+1[61 33 55 61 55 1[55 10[66 1[61 5[72 2[72 1[28 1[78
+3[72 2[97 17[28 33 1[58 43[{TeXBase1Encoding ReEncodeFont}30
+99.6264 /Helvetica-Bold rf /Fn 133[72 80 3[88 48 80 56
+1[88 88 88 128 40 80 1[40 88 88 48 80 88 80 88 80 7[96
+1[135 2[88 96 104 112 96 112 1[120 88 2[40 1[112 88 2[104
+104 104 18[40 6[40 39[{TeXBase1Encoding ReEncodeFont}39
+143.462 /Helvetica-Bold rf /Fo 138[126 1[115 80 2[126
+126 184 57 2[57 1[126 1[115 126 2[115 16[138 161 149
+172 5[161 1[138 69[{TeXBase1Encoding ReEncodeFont}18
+206.584 /Helvetica-Bold rf end
+%%EndProlog
+%%BeginSetup
+%%Feature: *Resolution 600dpi
+TeXDict begin
+%%PaperSize: A4
+
+%%EndSetup
+%%Page: 1 1
+1 0 bop Black Black 295 447 a Fo(GNOME)57 b(Pr)l(ogramming)h
+(Guidelines)1121 695 y Fn(Federico)38 b(Mena)g(Quinter)m(o)1335
+869 y Fm(f)o(ederico n)o(uc)n(lecu.unam.mx)1414 1291
+y Fn(Miguel)g(de)i(Icaza)1547 1479 y Fm(miguel kernel or)o(g)1380
+1900 y Fn(Mor)s(ten)e(W)-5 b(elinder)496 2116 y Fl(This)23
+b(article)e(contains)j(several)d(guidelines)i(and)f(suggestions)i(for)e
+(GNOME)g(pr)o(ogram-)496 2208 y(mers,)d(as)g(well)h(as)f(certain)g
+(policies)h(that)f(should)h(be)f(followed)h(when)g(writing)g(GNOME)496
+2299 y(pr)o(ograms.)d(This)h(is)h(intended)e(for)h(pr)o(ogrammers)f(to)
+i(know)g(about)e(the)h(GNOME)g(devel-)496 2390 y(opment)h(pr)o(ocess)g
+(and)f(its)h(philosophy)-9 b(.)20 b(GNOME)e(is)h(a)g(team)f(ef)o(fort,)
+f(so)i(it)g(will)h(be)e(useful)496 2482 y(for)i(pr)o(ogrammers)h(to)g
+(know)g(\223the)g(way)g(things)h(ar)o(e)d(done\224.)p
+Black Black eop
+%%Page: 2 2
+2 1 bop Black Black 197 401 a Fn(Intr)m(oduction)596
+564 y Fl(GTK+,)30 b(the)f(basic)g(user)h(interface)e(library)h(for)g
+(GNOME,)g(has)h(taught)g(us)f(some)h(important)596 656
+y(lessons)h(in)g(softwar)o(e)e(design.)i(The)f(GTK+)i(code)e(is)g
+(clean,)g(consistent,)i(maintainable,)d(and)596 747 y(makes)i(sense.)h
+(Such)g(code)f(is)h(not)g(only)h(a)e(pleasur)o(e)g(to)h(work)g(with,)g
+(but)g(also)g(encourages)596 838 y(good)21 b(pr)o(ogramming)g
+(practices)f(on)h(those)h(who)f(extend)f(and)h(modify)g(it.)596
+971 y(In)31 b(this)h(article)e(we)h(try)g(to)h(pr)o(esent)e(some)i
+(suggestions)g(and)f(guidelines)h(that)f(you)g(should)596
+1062 y(take)18 b(into)i(account)f(when)h(writing)g(code)e(for)h(the)g
+(GNOME)g(pr)o(oject.)g(W)-8 b(e)19 b(pr)o(esent)f(some)i(of)f(the)596
+1154 y(policies)25 b(that)g(must)h(be)e(followed)i(when)g(modifying)g
+(other)f(people's)g(code,)f(using)i(the)g(CVS)596 1245
+y(r)o(epository)-9 b(,)17 b(and)g(making)h(sur)o(e)e(your)i(code)f(is)h
+(\002t)g(for)f(inclusion)i(in)f(GNOME.)f(W)-8 b(e)18
+b(also)g(pr)o(esent)596 1336 y(information)j(that)g(will)g(be)g(useful)
+f(to)i(package)d(maintainers.)596 1469 y(Please)g(make)g(sur)o(e)g(you)
+i(r)o(ead)d(the)i(GNU)f(Coding)i(Standar)o(ds)c(in)j(addition)g(to)g
+(this)h(document.)596 1561 y(These)h(ar)o(e)e(available)h(as)h(the)g
+Fk(\(Standards\))f Fl(info)h(node)h(in)f(the)h(standar)o(d)d(GNU)i
+(documenta-)596 1652 y(tion.)197 2042 y Fn(The)39 b(Impor)s(tance)e(of)
+i(Writing)g(Good)g(Code)596 2206 y Fl(GNOME)16 b(is)g(a)g(very)g
+(ambitious)h(fr)o(ee)e(softwar)o(e)h(pr)o(oject,)f(and)h(as)g(such)h
+(it)g(is)g(composed)f(of)h(many)596 2297 y(softwar)o(e)j(packages)g
+(that)h(ar)o(e)e(mor)o(e)i(or)g(less)g(independent)g(of)g(each)f(other)
+-6 b(.)21 b(Most)g(of)g(the)g(work)596 2388 y(in)k(GNOME)f(is)h(done)g
+(by)f(volunteers;)h(pr)o(ogrammers)f(may)h(come)g(and)f(go)h(at)f(any)g
+(time)h(and)596 2480 y(they)c(will)g(be)g(able)f(to)i(dedicate)d(dif)o
+(fer)o(ent)g(amounts)j(of)f(time)g(to)g(the)g(GNOME)g(pr)o(oject.)f
+(Many)596 2571 y(people)e(work)i(on)f(fr)o(ee)e(softwar)o(e)h(on)i
+(their)f(spar)o(e)e(time)i(or)g(as)g(a)f(hobby)-9 b(,)19
+b(so)g(if)g(their)g(`r)o(eal)f(world')596 2662 y(r)o(esponsibilities)25
+b(change,)f(this)i(will)f(be)g(r)o(e\003ected)e(in)i(the)g(amount)g(of)
+g(work)g(they)g(can)f(do)h(for)596 2754 y(fr)o(ee)19
+b(softwar)o(e)h(pr)o(ojects.)596 2886 y(Softwar)o(e)14
+b(takes)j(a)e(long)j(time)f(to)f(write)h(and)f(it)h(involves)g(lar)o
+(ge)e(amounts)i(of)g(work.)f(This)h(is)g(why)596 2978
+y(most)26 b(part-time)f(volunteers)h(cannot)g(start)f(big)h(pr)o
+(ojects)g(by)g(themselves;)g(it)f(is)i(much)f(easier)596
+3069 y(and)e(mor)o(e)h(r)o(ewar)o(ding)f(to)i(contribute)g(to)f
+(existing)h(pr)o(ojects,)f(as)g(this)h(yields)g(r)o(esults)f(that)g(ar)
+o(e)596 3160 y(immediately)20 b(visible)h(and)g(usable.)596
+3293 y(Considering)29 b(this,)g(and)f(also)g(the)h(fact)e(that)h(fr)o
+(ee)f(softwar)o(e)h(pr)o(ogrammers)f(ar)o(e)g(a)h(scar)o(ce)f(r)o(e-)
+596 3385 y(sour)o(ce,)c(we)g(conclude)h(that)g(it)g(is)g(very)f
+(important)i(for)e(existing)i(pr)o(ojects)e(to)h(make)g(it)g(as)f(easy)
+596 3476 y(as)18 b(possible)i(for)f(people)g(to)g(contribute)h(to)f
+(them.)h(One)f(way)g(of)g(doing)h(this)g(is)g(by)f(making)h(sur)o(e)596
+3567 y(that)g(pr)o(ograms)g(ar)o(e)g(easy)g(to)h(r)o(ead,)e
+(understand,)h(and)g(modify)-9 b(.)596 3700 y(Messy)17
+b(code)f(is)i(har)o(d)e(to)h(r)o(ead,)e(and)i(people)g(may)g(lose)h
+(inter)o(est)f(if)f(they)i(cannot)f(decipher)g(what)596
+3791 y(the)i(code)g(tries)g(to)h(do.)f(Also,)g(it)g(is)h(important)f
+(that)h(pr)o(ogrammers)e(be)h(able)g(to)g(understand)g(the)596
+3883 y(code)j(quickly)h(so)g(that)f(they)h(can)f(start)g(contributing)i
+(with)f(bug)f(\002xes)h(and)f(enhancements)g(in)596 3974
+y(a)17 b(short)i(amount)f(of)g(time.)h(Sour)o(ce)e(code)g(is)i(a)e
+(form)h(of)g(communication,)i(and)d(just)i(as)f(someone)596
+4065 y(would)f(not)i(like)e(to)h(r)o(ead)e(a)g(novel)i(with)g(spelling)
+h(err)o(ors)d(and)h(sloppy)h(punctuation,)g(pr)o(ogram-)596
+4157 y(mers)i(should)h(strive)g(to)g(write)f(good)h(code)f(so)h(that)g
+(it)f(is)h(easy)f(to)h(understand)f(and)g(modify)h(by)596
+4248 y(others.)596 4381 y(These)k(ar)o(e)f(some)i(important)g
+(qualities)g(of)g(good)g(code,)e(and)i(why)g(each)f(one)h(of)f(them)h
+(is)g(im-)596 4472 y(portant)20 b(for)h(fr)o(ee)e(softwar)o(e)h
+(developers:)596 4729 y(Cleanliness)p Black Black 785
+4862 a(Clean)j(code)g(is)h(easy)f(to)h(r)o(ead;)e(this)i(lets)g(people)
+f(r)o(ead)f(it)h(with)i(minimum)g(ef)o(fort)d(so)i(that)762
+4954 y(they)d(can)f(understand)g(it)h(easily)-9 b(.)596
+5169 y(Consistency)p Black Black 783 5302 a(Consistent)24
+b(code)d(makes)h(it)g(easy)g(for)g(people)f(to)i(understand)e(how)i(a)e
+(pr)o(ogram)g(works;)762 5394 y(when)k(r)o(eading)f(consistent)i(code,)
+f(one)g(subconsciously)i(forms)e(a)g(number)g(of)g(assump-)p
+Black 3642 5876 a Fj(2)p Black eop
+%%Page: 3 3
+3 2 bop Black 2495 -132 a Fj(GNOME)20 b(Pr)o(ogramming)f(Guidelines)p
+Black 762 380 a Fl(tions)32 b(and)f(expectations)g(about)g(how)i(the)e
+(code)g(works,)h(so)g(it)g(is)g(easier)e(and)h(safer)g(to)762
+471 y(make)20 b(modi\002cations)i(to)f(it.)596 687 y(Extensibility)p
+Black Black 780 820 a(General-purpose)c(code)h(is)g(easier)g(to)g(r)o
+(euse)f(and)h(modify)g(than)h(very)e(speci\002c)h(code)g(with)762
+911 y(lots)27 b(of)g(har)o(dcoded)f(assumptions.)i(When)f(someone)h
+(wants)g(to)f(add)f(a)h(new)g(featur)o(e)f(to)762 1002
+y(a)i(pr)o(ogram,)f(it)i(will)g(obviously)h(be)e(easier)g(to)h(do)g(so)
+g(if)f(the)h(code)f(was)h(designed)f(to)h(be)762 1094
+y(extensible)j(fr)o(om)g(the)g(beginning.)i(Code)e(that)g(was)g(not)h
+(written)g(this)g(way)f(may)h(lead)762 1185 y(people)20
+b(into)i(having)f(to)g(implement)h(ugly)f(hacks)g(to)g(add)f(featur)o
+(es.)596 1401 y(Corr)o(ectness)p Black Black 789 1534
+a(Finally)-9 b(,)28 b(code)f(that)h(is)g(designed)f(to)h(be)f(corr)o
+(ect)g(lets)g(people)h(spend)f(less)h(time)g(worry-)762
+1625 y(ing)d(about)g(bugs)g(and)f(mor)o(e)h(time)g(enhancing)h(the)f
+(featur)o(es)e(of)i(a)f(pr)o(ogram.)g(Users)h(also)762
+1716 y(appr)o(eciate)18 b(corr)o(ect)i(code,)g(since)h(nobody)h(likes)f
+(softwar)o(e)f(that)g(crashes.)596 1932 y(T)-8 b(o)31
+b(summarize)f(this,)h(pr)o(ogrammers)f(often)g(contribute)h(to)g(fr)o
+(ee)e(sofwar)o(e)g(pr)o(ojects)i(in)g(their)596 2023
+y(spar)o(e)21 b(time,)i(and)f(even)g(r)o(egular)g(contributors)i(may)e
+(have)h(to)g(stop)g(doing)g(so)h(at)e(any)h(time,)f(so)596
+2115 y(it)f(is)h(important)g(that)f(the)h(code)f(be)g(good)h(so)g(that)
+f(they)h(can)f(modify)h(it)g(easily)-9 b(.)21 b(The)g(end)g(r)o(esult)
+596 2206 y(will)g(be)f(better)h(softwar)o(e)e(that)i(pr)o(ogrammers)f
+(will)i(like)f(to)g(enhance.)197 2596 y Fn(Coding)38
+b(Style)596 2760 y Fl(`Coding)22 b(style')h(r)o(efers)e(to)h(the)g(way)
+g(sour)o(ce)g(code)g(is)h(formatted.)e(For)h(C,)g(this)h(involves)g
+(things)596 2851 y(like)k(brace)f(placement,)h(indentation,)h(and)f
+(the)g(way)g(par)o(entheses)g(ar)o(e)f(used.)h(GNOME)g(has)596
+2942 y(a)c(mix)h(of)f(coding)h(styles,)g(and)f(we)h(do)g(not)g(enfor)o
+(ce)e(any)i(one)g(of)g(them.)f(The)h(most)g(important)596
+3034 y(thing)c(is)g(for)f(the)h(code)f(to)h(be)f(consistent)i(within)g
+(a)e(pr)o(ogram)g(or)g(library)g(\227)h(code)f(with)h(sloppy)596
+3125 y(formatting)h(is)g(not)g(acceptable,)e(since)i(it)g(is)g(har)o(d)
+f(to)h(r)o(ead.)596 3258 y(When)33 b(writing)g(a)f(new)h(pr)o(ogram)f
+(or)h(library)-9 b(,)31 b(please)h(follow)i(a)e(consistent)i(style)f
+(of)f(brace)596 3349 y(placement)26 b(and)h(indentation.)h(If)f(you)g
+(do)h(not)g(have)e(any)h(personal)h(pr)o(efer)o(ence)c(for)j(a)g
+(style,)596 3441 y(we)20 b(r)o(ecommend)h(the)g(Linux)f(kernel)h
+(coding)h(style,)e(or)h(the)g(GNU)g(coding)g(style.)596
+3573 y(Read)27 b(the)g Fk(\(Standards\)Writing)42 b(C)27
+b Fl(info)h(node)g(in)g(the)g(GNU)f(documentation.)h(Then,)g(get)596
+3665 y(the)18 b(Linux)h(kernel)g(sour)o(ces)f(and)g(r)o(ead)f(the)i
+(\002le)g Fk(linux/Documentation/CodingStyle)p Fl(,)13
+b(and)596 3756 y(ignor)o(e)30 b(Linus's)h(jokes.)g(These)f(two)h
+(documents)g(will)g(give)f(you)h(a)f(good)h(idea)e(of)i(what)f(we)596
+3847 y(r)o(ecommend)20 b(for)g(GNOME)h(code.)197 4152
+y Fi(Indentation)35 b(Style)596 4303 y Fl(For)18 b(cor)o(e)g(GNOME)g
+(code)g(we)h(pr)o(efer)d(the)j(Linux)f(kernel)h(indentation)g(style.)f
+(Use)g(8-space)f(tabs)596 4394 y(for)j(indentation.)596
+4527 y(Using)j(8-space)f(tabs)h(for)g(indentation)h(pr)o(ovides)f(a)g
+(number)g(of)h(bene\002ts.)f(It)g(makes)h(the)f(code)596
+4618 y(easier)k(to)h(r)o(ead,)f(since)h(the)h(indentation)g(is)f
+(clearly)g(marked.)f(It)h(also)h(helps)f(you)h(keep)f(your)596
+4709 y(code)g(honest)i(by)f(for)o(cing)f(you)h(to)g(split)h(functions)f
+(into)h(mor)o(e)e(modular)h(and)f(well-de\002ned)596
+4801 y(chunks)21 b(\227)f(if)g(your)g(indentation)h(goes)g(too)g(far)e
+(to)h(the)h(right,)f(then)h(it)f(means)g(your)h(function)g(is)596
+4892 y(designed)f(badly)g(and)h(you)g(should)g(split)h(it)f(to)g(make)f
+(it)h(mor)o(e)g(modular)f(or)h(r)o(e-think)g(it.)596
+5025 y(8-space)29 b(tabs)i(for)g(indentation)h(also)f(helps)h(you)f(to)
+h(design)f(functions)i(that)e(\002t)g(nicely)h(in)f(a)596
+5116 y(single)26 b(scr)o(een,)e(which)i(means)f(that)g(people)g(can)g
+(understand)g(the)h(code)e(without)j(having)f(to)596
+5208 y(scr)o(oll)20 b(back)g(and)h(forth)g(in)g(or)o(der)f(to)h
+(understand)f(it.)596 5340 y(If)e(you)i(use)f(Emacs,)g(then)h(you)f
+(can)g(select)g(the)h(Linux)f(kernel)g(indentation)h(style)g(by)f
+(including)596 5432 y(this)i(in)g(your)g Fk(.emacs)f
+Fl(\002le:)p Black 3642 5876 a Fj(3)p Black eop
+%%Page: 4 4
+4 3 bop Black 197 -132 a Fj(GNOME)20 b(Pr)o(ogramming)f(Guidelines)p
+Black 596 380 a Fk(\(add-hook)43 b('c-mode-common-hook)1044
+462 y(\(lambda)g(\(\))1133 544 y(\(c-set-style)g("k&r"\))1133
+626 y(\(setq)h(c-basic-offset)f(8\)\)\))596 801 y Fl(On)32
+b(newer)f(Emacsen)g(or)h(with)h(a)e(newer)g(cc-mode,)g(you)h(may)g(be)f
+(able)g(to)h(simply)h(do)e(this)596 892 y(instead:)596
+1057 y Fk(\(add-hook)43 b('c-mode-common-hook)1044 1139
+y(\(lambda)g(\(\))1133 1222 y(\(c-set-style)g("linux"\)\)\))596
+1396 y Fl(If)17 b(you)i(use)f(vim,)g(then)g(you)h(can)e(select)h(the)g
+(GNOME)g(kernel)g(indentation)h(style)f(by)g(including)596
+1487 y(this)j(fragment)f(in)i(your)f Fk(~/.vimrc)e Fl(\002le:)596
+1652 y Fk(set)44 b(ts=8)596 1735 y(if)g
+(!exists\("autocommands_loaded"\))685 1817 y(let)h(autocommands_loaded)
+c(=)k(1)685 1899 y(augroup)f(C)865 1981 y(autocmd)f(BufRead)h(*.c)g
+(set)g(cindent)685 2063 y(augroup)g(END)596 2146 y(endif)596
+2361 y Fl(The)23 b(GNU)g(indentation)i(style)e(is)h(the)g(default)e
+(for)h(Emacs,)g(so)h(you)g(do)g(not)g(need)f(to)h(put)f(any-)596
+2453 y(thing)h(in)g(your)g Fk(.emacs)f Fl(to)h(enable)f(it.)h(If)f(you)
+h(wish)h(to)f(select)f(it)h(explicitly)-9 b(,)23 b(substitute)h
+(\223gnu\224)596 2544 y(for)c(\223linux\224)g(in)i(the)e(example)g
+(above.)596 2677 y(If)f(you)i(know)g(how)g(to)f(customize)h
+(indentation)f(styles)h(in)g(other)f(popular)g(editors,)f(please)h
+(tell)596 2768 y(us)h(about)f(it)h(so)g(that)g(we)g(can)f(expand)g
+(this)i(document.)197 3114 y Fi(Naming)35 b(Con)-5 b(ventions)596
+3265 y Fl(It)16 b(is)g(important)h(to)f(follow)h(a)f(good)h(naming)g
+(convention)g(for)f(the)g(symbols)i(in)e(your)h(pr)o(ograms.)596
+3356 y(This)33 b(is)f(especially)g(important)h(for)g(libraries,)e
+(since)i(they)g(should)g(not)g(pollute)g(the)g(global)596
+3448 y(namespace)26 b(\227)h(it)g(is)h(very)f(annoying)h(when)g(a)e
+(library)h(has)g(sloppily-named)h(symbols)g(that)596
+3539 y(clash)20 b(with)i(names)f(you)g(may)g(want)g(to)g(use)g(in)g
+(your)g(pr)o(ograms.)596 3672 y(Function)h(names)g(should)g(be)f(of)h
+(the)f(form)h Fk(module_submodule_operation)p Fl(,)17
+b(for)k(example,)596 3763 y Fk(gnome_canvas_set_scroll_region)10
+b Fl(or)16 b Fk(gnome_mime_get_keys)p Fl(.)d(This)j(naming)g(conven-)
+596 3854 y(tion)24 b(eliminates)h(inter)o(-module)e(clashes)h(of)g
+(symbol)h(names.)f(This)g(is)g(very)g(important)g(for)g(li-)596
+3946 y(braries.)596 4079 y(Symbols)29 b(should)g(have)g(descriptive)f
+(names.)g(As)h(Linus)g(says,)g(do)g(not)g(use)g Fk(cntusr\(\))p
+Fl(,)e(use)596 4170 y Fk(count_active_users\(\))17 b
+Fl(instead.)k(This)g(makes)g(code)g(very)g(easy)f(to)i(r)o(ead)d(and)i
+(almost)h(self-)596 4261 y(documenting.)596 4394 y(T)-7
+b(ry)20 b(to)h(use)g(the)f(same)h(naming)h(conventions)g(as)e(in)i
+(GTK+)f(and)f(the)h(GNOME)g(libraries:)p Black 596 4610
+a Fh(\225)p Black 58 w Fl(Function)c(names)f(ar)o(e)f(lower)o(case,)f
+(with)j(underscor)o(es)e(to)h(separate)e(wor)o(ds,)i(like)g(this:)g
+Fk(gnome_canvas_set_scroll_region\(\))p Fl(,)679 4701
+y Fk(gnome_mime_get_keys\(\))p Fl(.)p Black 596 4834
+a Fh(\225)p Black 61 w Fl(Macr)o(os)h(and)h(enumerations)h(ar)o(e)e
+(upper)o(case,)f(with)j(underscor)o(es)f(to)h(separate)e(wor)o(ds,)h
+(like)679 4925 y(this:)k(GNOMEUIINFO_SUBTREE\(\))d(for)i(a)g(macr)o(o,)
+g(and)g(GNOME_INTERACT_NONE)679 5017 y(for)f(an)h(enumeration)g(value.)
+p Black 596 5150 a Fh(\225)p Black 64 w Fl(T)-7 b(ypes)21
+b(and)g(str)o(uctur)o(e)g(names)g(ar)o(e)f(mixed)h(upper)g(and)g(lower)
+o(case,)f(like)i(this:)g(GnomeCan-)679 5241 y(vasItem,)e
+(GnomeIconList.)596 5374 y(Using)f(underscor)o(es)e(to)i(separate)e
+(wor)o(ds)i(makes)f(the)h(code)f(less)h(cramped)f(and)g(easier)g(to)g
+(edit,)596 5465 y(since)j(you)g(can)f(use)h(your)g(editor)6
+b('s)21 b(wor)o(d)g(commands)g(to)g(navigate)f(quickly)-9
+b(.)p Black 197 5876 a Fj(4)p Black eop
+%%Page: 5 5
+5 4 bop Black 2495 -132 a Fj(GNOME)20 b(Pr)o(ogramming)f(Guidelines)p
+Black 596 380 a Fl(If)27 b(you)i(ar)o(e)e(writing)i(a)f(library)-9
+b(,)27 b(then)h(you)h(may)f(need)g(to)h(have)e(exported)h(symbols)h
+(that)f(ar)o(e)596 471 y(to)c(be)f(used)g(only)i(within)g(the)f
+(library)-9 b(.)23 b(For)h(example,)f(two)h(of)g(the)f(object)h
+(\002les)h(that)e(compose)596 562 y(the)d(library)g Fk(libfoo.so)f
+Fl(may)h(need)g(to)h(access)f(symbols)h(fr)o(om)f(each)g(other)-6
+b(,)20 b(but)h(this)g(symbols)596 654 y(ar)o(e)f(not)j(meant)e(to)i(be)
+e(used)h(fr)o(om)g(user)f(pr)o(ograms.)g(In)i(that)f(case,)f(put)g(an)h
+(underscor)o(e)f(befor)o(e)596 745 y(the)d(function)h(name)g(and)f
+(make)g(the)h(\002rst)g(wor)o(ds)f(follow)h(the)g(standar)o(d)e
+(module/submodule)596 836 y(convention.)f(For)h(example,)d(you)j(could)
+f(have)f(a)g(function)i(called)e Fk(_foo_internal_frobnicate\(\))p
+Fl(.)596 1104 y Fm(Consistenc)o(y)29 b(in)e(Naming)596
+1245 y Fl(It)17 b(is)i(important)f(that)g(your)g(variables)e(be)i
+(consistently)h(named.)f(For)g(example,)e(a)i(module)g(that)596
+1336 y(does)g(a)g(list)g(manipulation)h(may)g(choose)g(to)f(name)g(the)
+h(variables)e(that)h(hold)h(a)f(list)g(pointer)h(\223l\224,)596
+1427 y(for)f(terseness)h(and)g(simplicity)-9 b(.)19 b(However)-6
+b(,)19 b(it)g(is)g(important)h(that)e(a)h(module)g(that)g(manipulates)
+596 1519 y(widgets)i(and)g(sizes)g(does)g(not)h(use)f(variables)g
+(called)f(\223w\224)g(for)h(both)h(widgets)g(and)f(widths)h(\(as)596
+1610 y(in)f(width/height)h(values\);)e(this)h(would)h(make)e(the)h
+(code)f(inconsistent)j(and)d(har)o(der)f(to)j(r)o(ead.)596
+1743 y(Of)k(course,)f(these)i(very)e(short)i(and)f(terse)g(names)g
+(should)h(only)g(be)f(used)g(for)f(the)i(local)f(vari-)596
+1834 y(ables)20 b(of)h(functions.)g(Never)f(call)h(a)f(global)h
+(variable)e(\223x\224;)h(use)h(a)f(longer)h(name)g(that)g(tells)g(what)
+596 1926 y(it)f(does.)197 2354 y Fi(Cleanliness)596 2505
+y Fl(GNOME)j(code)g(should)h(be)f(as)g(clean)g(as)g(possible.)h(This)g
+(implies)g(using)g(a)f(consistent)i(inden-)596 2597 y(tation)31
+b(style)f(and)g(good)i(naming)f(conventions,)h(as)e(described)f(above.)
+h(It)h(also)g(implies)g(the)596 2688 y(following.)596
+2821 y(Learn)d(the)i(corr)o(ect)f(use)h(of)g(the)g(static)f(keywor)o
+(d.)h(Do)g Fj(not)g Fl(make)f(all)h(your)g(symbols)h(global.)596
+2912 y(This)23 b(has)f(the)h(advantage)e(that)i(you)g(can)f(use)h
+(shorter)f(names)h(for)f(internal)h(functions)h(within)596
+3003 y(a)f(single)i(sour)o(ce)f(\002le,)g(since)g(they)g(ar)o(e)f(not)i
+(globally)g(visible)f(and)g(thus)g(you)h(do)f(not)h(need)f(the)596
+3095 y(module/submodule)d(pr)o(e\002x.)596 3228 y(Learn)28
+b(the)i(corr)o(ect)f(use)g(of)h(the)g(const)g(keywor)o(d.)f(Use)g(it)h
+(consistently)-9 b(,)31 b(as)e(it)h(can)f(make)h(the)596
+3319 y(compiler)21 b(catch)f(a)g(lot)h(of)g(stupid)g(bugs)g(for)g(you.)
+596 3452 y(If)27 b(you)i(have)e(a)h(function)h(that)f(r)o(eturns)f(a)h
+(pointer)g(to)h(internal)f(data)f(which)i(the)f(user)g(is)g(not)596
+3543 y(supposed)22 b(to)g(fr)o(ee,)e(you)j(should)f(use)g(a)g(const)g
+(modi\002er)-6 b(.)22 b(This)h(will)f(warn)g(the)g(user)g(if)g(he)g
+(tries)596 3634 y(to)f(do)f(something)j(incorr)o(ect,)d(for)g(example:)
+596 3800 y Fk(const)44 b(char)g(*gnome_mime_get_info)d(\(const)j(char)g
+(*info\);)596 3974 y Fl(The)22 b(compiler)h(will)g(warn)g(the)f(user)h
+(if)f(he)h(tries)g(to)g(fr)o(ee)e(the)h(r)o(eturned)g(string.)h(This)g
+(can)f(catch)596 4065 y(a)e(lot)h(of)g(bugs.)596 4198
+y(If)h(you)i(have)e(random)h(`magic)h(values')e(in)i(your)f(pr)o(ogram)
+g(or)g(library)-9 b(,)22 b(use)h(macr)o(os)g(to)g(de\002ne)596
+4289 y(them)e(instead)f(of)h(har)o(dcoding)f(them)h(wher)o(e)f(they)i
+(ar)o(e)d(used:)596 4455 y Fk(/*)44 b(Amount)g(of)g(padding)g(for)g
+(GUI)h(elements)e(*/)596 4537 y(#define)g(GNOME_PAD)447
+b(8)596 4619 y(#define)43 b(GNOME_PAD_SMALL)177 b(4)596
+4701 y(#define)43 b(GNOME_PAD_BIG)267 b(12)596 4917 y
+Fl(If)19 b(you)h(have)f(a)g(list)h(of)g(possible)g(values)f(for)h(a)f
+(variable,)f(do)h(not)i(use)e(macr)o(os)g(for)h(them;)f(use)h(an)596
+5008 y(enum)g(instead)g(and)g(give)g(it)g(a)g(type)g(name)g(\227)g
+(this)g(lets)h(you)f(have)g(symbolic)h(names)f(for)g(those)596
+5100 y(values)g(in)h(a)f(debugger)-6 b(.)19 b(Also,)i(do)f(not)i(use)e
+(an)h(`int')g(to)g(stor)o(e)f(an)h(enumeration)f(value;)g(use)h(the)596
+5191 y(enum)j(type)h(instead.)f(This)h(lets)g(the)f(compiler)h(catch)f
+(err)o(ors)g(for)g(you,)h(allows)g(the)g(debugger)596
+5282 y(to)d(show)i(pr)o(oper)e(values)g(for)g(these)h(values)f(and)g
+(makes)g(it)h(obvious)g(what)g(values)f(a)g(variable)596
+5374 y(can)e(take.)g(An)h(example)f(follows:)p Black
+3642 5876 a Fj(5)p Black eop
+%%Page: 6 6
+6 5 bop Black 197 -132 a Fj(GNOME)20 b(Pr)o(ogramming)f(Guidelines)p
+Black 596 380 a Fk(/*)44 b(Shadow)g(types)g(*/)596 462
+y(typedef)f(enum)h({)596 544 y(GTK_SHADOW_NONE,)596 626
+y(GTK_SHADOW_IN,)596 708 y(GTK_SHADOW_OUT,)596 791 y
+(GTK_SHADOW_ETCHED_IN,)596 873 y(GTK_SHADOW_ETCHED_OUT)596
+955 y(})g(GtkShadowType;)596 1119 y(void)g(gtk_frame_set_shadow_type)c
+(\(GtkFrame)k(*frame,)f(GtkShadowType)g(type\);)596 1335
+y Fl(If)20 b(you)h(de\002ne)g(a)f(set)h(of)g(values)f(for)g(a)h(bit)g
+(\002eld,)f(do)h(it)g(like)g(this:)596 1500 y Fk(/*)44
+b(Update)g(flags)g(for)g(items)g(*/)596 1583 y(enum)g({)596
+1665 y(GNOME_CANVAS_UPDATE_REQUESTED)84 b(=)45 b(1)g(\253)f(0,)596
+1747 y(GNOME_CANVAS_UPDATE_AFFINE)219 b(=)45 b(1)g(\253)f(1,)596
+1829 y(GNOME_CANVAS_UPDATE_CLIP)309 b(=)45 b(1)g(\253)f(2,)596
+1911 y(GNOME_CANVAS_UPDATE_VISIBILITY)39 b(=)45 b(1)g(\253)f(3,)596
+1994 y(GNOME_CANVAS_UPDATE_IS_VISIBLE)39 b(=)45 b(1)g(\253)f(4)596
+2076 y(};)596 2250 y Fl(This)22 b(makes)f(it)h(easier)f(to)h(modify)f
+(the)h(list)g(of)g(values,)f(and)g(is)h(less)g(err)o(or)o(-pr)o(one)d
+(than)j(specify-)596 2341 y(ing)f(the)g(values)f(by)h(hand.)f(It)h
+(also)g(lets)g(you)g(use)g(those)h(values)e(as)g(symbols)i(in)g(a)e
+(debugger)-6 b(.)596 2474 y(Do)17 b(not)h(write)g(obfuscated)e(code,)h
+(but)g(also)h(try)f(to)h(be)f(spartan.)f(Do)i(not)g(use)g(mor)o(e)f
+(par)o(entheses)596 2566 y(than)24 b(ar)o(e)f(necessary)h(to)h(clarify)
+f(an)g(expr)o(ession.)g(Use)g(spaces)g(befor)o(e)g(par)o(entheses)f
+(and)h(after)596 2657 y(commas,)d(and)f(also)h(ar)o(ound)f(binary)g
+(operators.)596 2790 y(Please)d(do)g(not)h(put)g(hacks)f(in)h(the)g
+(code.)f(Instead)g(of)g(writing)i(an)e(ugly)h(hack,)f(r)o(e-work)g(the)
+g(code)596 2881 y(so)k(that)g(it)f(is)i(clean,)e(extensible)g(and)h
+(maintainable.)596 3014 y(Make)16 b(sur)o(e)i(your)g(code)g(compiles)g
+(with)h(absolutely)f(no)h(warnings)g(fr)o(om)e(the)h(compiler)-6
+b(.)18 b(These)596 3105 y(help)i(you)i(catch)e(stupid)h(bugs.)g(Use)f
+(function)i(pr)o(ototypes)e(in)i(header)d(\002les)i(consistently)-9
+b(.)596 3238 y(W)k(ithin)22 b(GNOME)f(you)h(can)e(use)i(the)f
+(GNOME_COMPILE_W)-8 b(ARNINGS)19 b(Autoconf)j(macr)o(o)596
+3329 y(in)d(your)g Fk(configure.in)p Fl(.)e(This)j(will)f(take)g(car)o
+(e)e(of)i(turning)h(on)g(a)f(good)g(set)g(of)g(compiler)g(warn-)596
+3421 y(ings)i(in)g(a)g(portable)f(fashion.)596 3554 y(Comment)29
+b(your)f(code.)g(Please)g(put)h(a)e(comment)j(befor)o(e)d(each)g
+(function)j(that)e(says)g(what)h(it)596 3645 y(does.)c(Do)i(not)f(say)g
+(how)h(it)f(does)g(it)g(unless)h(it)f(is)g(absolutely)h(necessary;)e
+(this)i(should)f(be)g(ob-)596 3736 y(vious)d(fr)o(om)g(r)o(eading)f
+(the)h(code.)f(If)h(it)g(is)g(not,)h(you)f(may)g(want)g(to)g(r)o(ework)
+g(it)g(until)h(the)f(code)g(is)596 3828 y(easy)d(to)h(understand.)596
+3960 y(While)28 b(documenting)h(API)f(functions)h(for)f(a)g(library)-9
+b(,)27 b(please)g(follow)i(the)g(guidelines)f(speci-)596
+4052 y(\002ed)17 b(in)h(the)g(\002le)g Fk
+(gnome-libs/devel-docs/api-comment-style.t)o(xt)p Fl(.)12
+b(This)18 b(allows)h(your)596 4143 y(sour)o(ce)26 b(code)g(to)i(pr)o
+(ovide)e(inline)h(documentation)h(that)f(is)g(later)f(extracted)f(by)i
+(the)g Fk(gtk-doc)596 4234 y Fl(system)21 b(to)g(cr)o(eate)e(a)h
+(DocBook)i(manual)f(automatically)-9 b(.)596 4502 y Fm(GTK+-related)28
+b(Issues)596 4643 y Fl(GTK+)g(lets)f(you)h(do)f(a)g(lot)h(of)g(magic)f
+(and)g(obfuscation)g(with)i(signal)e(handlers,)g(passed)g(clo-)596
+4734 y(sur)o(es,)c(and)g(datasets.)g(If)h(you)h(\002nd)f(yourself)g
+(doing)h(a)e(lot)i(of)f(gtk_object_set_data\(\))d(all)j(over)596
+4825 y(the)d(place,)f(or)h(passing)g(state)g(ar)o(ound)f(in)i(bizarr)o
+(e)d(ways)i(via)g(signal)g(handlers,)g(please)f(r)o(ework)596
+4917 y(the)27 b(code.)g(If)h(you)g(need)f(to)h(attach)f(a)g(lot)h(of)g
+(data)e(to)i(a)f(particular)g(object,)g(then)h(it)g(is)g(a)f(good)596
+5008 y(candidate)g(for)h(a)h(new)g(derived)e(class,)i(which)g(will)h
+(not)f(only)h(make)e(the)h(code)f(cleaner)-6 b(,)28 b(but)596
+5099 y(mor)o(e)20 b(extensible)h(as)f(well.)596 5232
+y(A)g(lot)h(of)f(heuristics)h(in)g(complicated)f(event)g(handlers)g
+(can)h(often)f(be)g(r)o(eplaced)f(by)h(clean)g(code)596
+5324 y(in)29 b(the)h(form)f(of)h(a)e(state)h(machine.)h(This)g(is)f
+(useful)h(when)g(you)f(want)h(to)g(implement)g(tricky)p
+Black 197 5876 a Fj(6)p Black eop
+%%Page: 7 7
+7 6 bop Black 2495 -132 a Fj(GNOME)20 b(Pr)o(ogramming)f(Guidelines)p
+Black 596 380 a Fl(things)24 b(like)f(selection)h(and)e(dragging)h
+(behavior)-6 b(,)23 b(and)f(will)i(make)f(the)g(code)g(easier)f(to)h
+(debug)596 471 y(and)d(extend.)197 1027 y Fn(Correctness)37
+b(and)i(Rob)m(ustness)596 1190 y Fl(It)25 b(is)g(extr)o(emely)f
+(important)h(that)g(GNOME)g(code)g(be)f(corr)o(ect)g(and)h(r)o(obust.)f
+(This)i(means)f(that)596 1281 y(the)16 b(code)g(should)h(do)g(what)g
+(is)f(expected)f(of)i(it,)f(and)g(it)h(should)g(handle)f(exceptional)g
+(conditions)596 1373 y(gracefully)-9 b(.)23 b(While)i(this)g(may)g
+(seem)f(obvious,)i(this)f(section)g(will)g(give)g(you)g(some)g(tips)g
+(about)596 1464 y(how)d(to)g(ensur)o(e)f(corr)o(ectness)g(in)i(your)f
+(GNOME)f(code.)g(This)i(is)f(very)f(important,)h(since)g(users)596
+1555 y(expect)d(and)i(deserve)e(r)o(eliable)h(softwar)o(e)g(that)g
+(does)h(not)h(crash)e(and)g(performs)h(corr)o(ectly)-9
+b(.)197 1860 y Fi(Ensuring)33 b(Consistenc)o(y)596 2011
+y Fl(Use)17 b(the)i(Glib)g(assertion)f(macr)o(os)g(to)h(ensur)o(e)e
+(that)i(your)f(pr)o(ogram's)g(state)g(is)h(consistent.)g(These)596
+2102 y(macr)o(os)h(help)g(locate)g(bugs)h(very)f(quickly)-9
+b(,)21 b(and)f(you'll)i(spend)e(much)h(less)g(time)g(in)g(the)g(debug-)
+596 2193 y(ger)f(if)h(you)g(use)g(them)g(liberally)f(and)h
+(consistently)-9 b(.)596 2326 y(Insert)17 b(sanity)h(checks)g(in)g
+(your)g(code)f(at)g(important)h(spots)h(like)f(the)f(beginning)i(of)f
+(public)f(func-)596 2417 y(tions,)23 b(at)f(the)h(end)g(of)g(code)f
+(that)h(does)f(a)h(sear)o(ch)e(that)i(must)g(always)g(succeed,)f(and)g
+(any)h(place)596 2509 y(wher)o(e)d(the)h(range)f(of)h(computed)f
+(values)h(is)g(important.)197 2854 y Fi(Asser)r(tions)35
+b(and)f(Preconditions)596 3006 y Fl(Assertions)17 b(and)g(pr)o
+(econditions)h(help)g(you)g(ensur)o(e)e(that)i(your)f(pr)o(ogram's)g
+(state)g(is)h(consistent.)596 3097 y(Glib)25 b(pr)o(ovides)f(macr)o(os)
+g(to)h(put)g(assertions)g(and)f(pr)o(econditions)h(in)g(your)g(code.)f
+(Y)-8 b(ou)26 b(should)596 3188 y(use)e(them)h(liberally;)g(in)g(r)o
+(eturn)f(they)h(will)g(help)g(you)h(locate)e(bugs)h(very)f(quickly)-9
+b(,)26 b(and)e(you'll)596 3280 y(spend)c(much)h(less)h(time)f(in)g(the)
+g(debugger)f(tracking)h(bugs)g(down.)596 3412 y(These)30
+b(ar)o(e)f(the)h(Glib)h(macr)o(os)f(for)g(pr)o(econditions;)h(they)g
+(will)g(emit)g(a)e(message)i(when)g(their)596 3504 y(conditions)e
+(fail,)f(and)g(they)g(will)h(r)o(eturn)f(the)g(function)h(fr)o(om)f
+(which)h(they)g(ar)o(e)e(called.)g(They)596 3595 y(should)21
+b(be)g(used)f(at)g(the)h(beginning)h(of)f(functions.)596
+3852 y(g_r)o(eturn_if_fail)d(\(condition\))p Black Black
+782 3985 a(Returns)k(fr)o(om)e(the)h(curr)o(ent)f(function)h(if)g
+(condition)h(is)f(false.)596 4201 y(g_r)o(eturn_val_if_fail)c
+(\(condition,)k(value\))p Black Black 782 4334 a(Returns)h(the)f
+(speci\002ed)f(value)g(fr)o(om)g(the)h(curr)o(ent)f(function)i(if)e
+(condition)i(is)g(false.)596 4550 y(These)f(ar)o(e)g(the)h(macr)o(os)g
+(for)f(assertions.)h(They)h(will)f(emit)g(a)g(message)g(when)g(their)g
+(conditions)596 4641 y(fail)f(and)g(will)h(call)g Fk(abort\(3\))e
+Fl(to)i(terminate)g(the)g(pr)o(ogram.)e(They)i(should)h(be)e(used)g(to)
+i(ensur)o(e)596 4732 y(consistency)f(for)e(the)h(code's)g(internals.)
+596 4990 y(g_assert)e(\(condition\))p Black Black 782
+5123 a(Aborts)i(the)g(pr)o(ogram)f(if)g(condition)i(is)g(false.)596
+5338 y(g_assert_not_r)o(eached)17 b(\(\))p Black Black
+782 5471 a(Aborts)k(the)g(pr)o(ogram)f(if)g(the)h(macr)o(o)f(is)i(ever)
+e(called.)p Black 3642 5876 a Fj(7)p Black eop
+%%Page: 8 8
+8 7 bop Black 197 -132 a Fj(GNOME)20 b(Pr)o(ogramming)f(Guidelines)p
+Black 596 380 a Fl(These)27 b(functions)h(should)g(be)f(used)g(to)g
+(impose)h(pr)o(econditions)g(on)f(the)h(code)f(and)f(check)i(its)596
+471 y(corr)o(ectness)18 b(\227)h(think)h(of)f(them)h(as)f(sanity)g
+(checks)h(for)f(your)g(pr)o(ogram.)f(Y)-8 b(ou)20 b(should)g(use)f
+(them)596 562 y(liberally)30 b(to)h(assist)f(you)i(in)e(catching)h
+(bugs)g(quickly;)g(once)g(your)g(pr)o(ogram)f(or)g(is)h(fully)g(de-)596
+654 y(bugged,)20 b(you)h(can)g(compile)h(it)f(with)g(these)h(macr)o(os)
+e(disabled)g(so)i(that)e(they)i(will)f(not)h(add)e(any)596
+745 y(r)o(untime)h(over)o(head.)596 878 y(The)28 b(g_r)o(eturn_*\(\))f
+(macr)o(os)h(should)i(be)e(used)h(at)f(the)h(beginning)h(of)f(public)g
+(functions)h(in)f(li-)596 969 y(braries)21 b(to)h(ensur)o(e)f(that)h
+(the)g(ar)o(guments)g(passed)f(to)i(them)f(ar)o(e)f(corr)o(ect)g(and)g
+(within)i(the)f(valid)596 1060 y(range.)e(If)h(a)g(function)h(r)o
+(eturns)f(nothing)i(\(i.e.)d(it)i(is)f(void\),)g(you)h(should)g(use)g
+(g_r)o(eturn_if_fail\(\).)596 1152 y(Otherwise,)i(you)h(should)h(use)e
+(g_r)o(eturn_val_if_fail\(\))c(to)25 b(r)o(eturn)f(a)g(`safe')f(value.)
+h(When)h(a)f(li-)596 1243 y(brary)g(function)i(that)g(uses)f(these)h
+(macr)o(os)f(is)g(invoked)h(with)g(incorr)o(ect)f(ar)o(gument)g
+(values,)g(it)596 1334 y(will)c(issue)h(an)f(err)o(or)f(message,)g(and)
+h(continue)h(r)o(unning.)g(The)f(client)g(pr)o(ogram)g(may)g(just)g
+(take)596 1426 y(a)f(hiccup,)g(do)h(nothing,)h(or)f(just)h(crash,)e
+(but)g(at)h(least)f(you)h(will)h(know)g Fj(wher)o(e)e
+Fl(you)h(have)g(passed)596 1517 y(an)f(incorr)o(ect)g(value)g(to)i(a)e
+(function.)596 1650 y(The)i(g_assert\(\))g(macr)o(o)g(should)i(be)e
+(use)h(to)h(ensur)o(e)e(the)h(internal)g(consistency)h(of)f(a)f
+(library)h(or)596 1741 y(pr)o(ogram.)28 b(Instead)h(of)h(r)o(eturning)f
+(fr)o(om)h(the)f(curr)o(ent)g(function)h(and)f(continuing)j(execution)
+596 1833 y(if)24 b(the)g(condition)i(fails,)e(g_assert\(\))f(issues)i
+(an)f(err)o(or)g(message)g(and)g(immediately)h(aborts)f(the)596
+1924 y(pr)o(ogram.)29 b(This)j(is)f(to)g(avoid)g(the)g(pr)o(ogram)f(fr)
+o(om)h(r)o(unning)h(in)f(an)g(inconsistent)i(state.)d(Y)-8
+b(ou)596 2015 y(should)22 b(use)g(this)h(macr)o(o)e(when)h(you)h(want)f
+(to)g(ensur)o(e)f(that)h(the)g(pr)o(ogram)f(or)h(library)g(is)g(using)
+596 2107 y(sane)e(internal)h(values.)596 2239 y(The)29
+b(g_assert_not_r)o(eached\(\))d(macr)o(o)i(is)i(used)f(to)h(mark)f(a)g
+(place)f(in)i(the)g(code)f(that)g(should)596 2331 y(never)18
+b(be)h(r)o(eached.)e(For)j(example,)e(if)h(you)h(have)f(a)f(switch)i
+(statement)g(and)f(you)g(think)i(you)e(ar)o(e)596 2422
+y(handling)d(all)g(the)f(possible)i(values)e(in)i(the)e(case)h(labels,)
+f(you)h(should)h(put)e(a)h(g_assert_not_r)o(eached\(\))596
+2513 y(in)28 b(the)h(default)f(label)g(to)g(ensur)o(e)g(that)h(the)f
+(code)h(never)f(gets)g(ther)o(e)g(\(this)h(would)g(mean)f(you)596
+2605 y(missed)21 b(handling)g(a)f(value,)g(or)h(your)g(pr)o(ogram)f(is)
+h(incorr)o(ect\).)596 2737 y(These)33 b(macr)o(os)g(help)h(you)g
+(\002nd)g(bugs)f(faster)g(by)h(warning)g(you)g(as)f(soon)i(as)e(the)h
+(pr)o(ogram)596 2829 y(r)o(eaches)28 b(an)h(inconsistent)i(state.)e
+(Use)g(them)h(fr)o(equently)-9 b(,)29 b(and)g(you)h(will)g(\002nd)g(a)f
+(lot)h(of)g(bugs)596 2920 y(very)20 b(easily)-9 b(.)197
+3266 y Fi(GTK+-related)34 b(Issues)596 3417 y Fl(Be)25
+b(car)o(eful)f(when)i(writing)h(event)e(handlers)h(\227)f(make)h(sur)o
+(e)f(they)h(mark)f(events)h(as)f(handled)596 3508 y(in)20
+b(the)g(pr)o(oper)e(situations.)j(Make)e(sur)o(e)g(your)h(signal)g
+(handlers)f(have)h(the)f(corr)o(ect)g(pr)o(ototypes.)596
+3600 y(This)30 b(is)h(very)e(important!)i(Remember)f(that)g(not)h(all)e
+(signal)i(handler)f(pr)o(ototypes)g(look)h(like)596 3691
+y(this:)596 3856 y Fk(static)43 b(void)h(my_handler)g(\(GtkWidget)f
+(*widget,)g(gpointer)h(data\);)596 4030 y Fl(For)24 b(example,)f(event)
+h(handlers)g(take)g(an)g(extra)f(event)h(parameter)e(and)i(r)o(eturn)f
+(a)h(gint)h(Check)596 4122 y(the)20 b(GTK+)i(header)e(\002les)h(if)f
+(you)i(need)e(to)h(double-check)f(this.)596 4255 y(Make)29
+b(sur)o(e)h(your)h(pr)o(ogram)f(deals)g(with)i(all)e(user)o(-generated)
+f(actions)i(in)g(the)g(pr)o(oper)e(way)-9 b(.)596 4346
+y(Remember)24 b(that)g(the)h(user)f(can)g(close)h(windows)h(at)e(any)g
+(time)h(with)g(the)f(window)i(manager;)596 4437 y(take)20
+b(this)h(into)h(account)f(and)f(write)h(the)g(necessary)f(code)g(to)i
+(handle)e(this.)596 4570 y(If)g(you)h(ar)o(e)f(testing)h(for)g
+(modi\002er)g(keys)g(in)g(an)f(event's)h(state)g(mask,)f(do)h(this:)596
+4735 y Fk(if)44 b(\(\(event->status)e(&)j(\(GDK_CONTROL_MASK)d(|)j
+(GDK_SHIFT_MASK\)\))775 4818 y(==)f(\(GDK_CONTROL_MASK)e(|)j
+(GDK_SHIFT_MASK\)\))596 4900 y(do_some_action)d(\(\);)596
+5074 y Fl(This)21 b(is)g(necessary;)f(if)h(you)g(do)g(this)g(instead)
+596 5239 y Fk(if)44 b(\(event->state)f(==)h(\(GDK_CONTROL_MASK)e(|)j
+(GDK_SHIFT_MASK\)\))596 5321 y(do_some_action)d(\(\);)p
+Black 197 5876 a Fj(8)p Black eop
+%%Page: 9 9
+9 8 bop Black 2495 -132 a Fj(GNOME)20 b(Pr)o(ogramming)f(Guidelines)p
+Black 596 380 a Fl(then)24 b(your)h(pr)o(ogram)f(will)h(not)g(work)g
+(corr)o(ectly)e(if)i(the)f(user)g(has)h(the)f(NumLock)h(key)f(on,)h
+(for)596 471 y(example)g(\227)i(NumLock)g(is)g(also)g(a)g(modi\002er)-6
+b(,)26 b(and)h(if)f(it)h(is)g(turned)g(on,)g(then)g(the)g(event)f
+(state)596 562 y(mask)20 b(will)i(not)f(be)g(what)g(the)g(second)g
+(example)f(expects.)596 830 y Fm(Visuals)28 b(and)g(Colormaps)596
+971 y Fl(Some)i(users)h(have)f(high-end)g(video)h(car)o(ds)e(\(SGIs)h
+(and)g(Suns,)h(for)f(example\))f(that)i(support)596 1062
+y(multiple)22 b(simultaneous)g(visuals.)g(Roughly)-9
+b(,)23 b(a)e(visual)h(de\002nes)f(the)h(memory)g(r)o(epr)o(esentation)
+596 1153 y(that)f(a)g(piece)g(of)h(har)o(dwar)o(e)d(uses)j(to)g(stor)o
+(e)f(the)h(contents)g(of)g(an)f(image.)h(Most)f(PC)h(video)f(car)o(ds)
+596 1245 y(support)e(a)g(single)h(visual)f(at)g(a)g(time,)h(but)f
+(high-end)h(har)o(dwar)o(e)d(can)i(have)f(dif)o(fer)o(ent)g(windows)596
+1336 y(and)i(pixmaps)g(in)i(dif)o(fer)o(ent)c(visuals)j(at)g(the)f
+(same)h(time.)596 1469 y(It)c(is)h(important)g(that)g(you)g(understand)
+f(visuals)h(and)f(colormaps)h(if)g(you)g(will)g(be)g(writing)g(code)596
+1560 y(that)27 b(cr)o(eates)f(windows)i(or)g(pixmaps)f(on)h(its)g(own,)
+g(instead)f(of)g(using)h(high-level)g(wrappers)596 1652
+y(like)i(GnomeCanvas)h(and)f(GnomePixmap.)h(Please)f(r)o(ead)f(an)h
+(Xlib)h(pr)o(ogramming)g(manual)596 1743 y(for)20 b(mor)o(e)h
+(information.)596 1876 y(In)k(general,)g(you)h(just)g(need)f(to)g(r)o
+(emember)g(that)g(the)h(visual)f(and)g(colormap)g(for)g(a)g(drawable)
+596 1967 y(must)f(match)f(the)h(ones)h(of)e(another)h(drawable)e(if)i
+(you)g(want)g(to)g(copy)f(an)h(ar)o(ea)e(fr)o(om)h(the)h(\002rst)596
+2058 y(drawable)17 b(into)j(the)f(second)g(one.)g(If)f(they)h(ar)o(e)f
+(not)h(the)g(same,)g(you)g(will)h(get)f(a)f(BadMatch)f(err)o(or)596
+2150 y(fr)o(om)j(X)h(and)f(you)i(application)e(will)i(most)f(likely)h
+(abort.)596 2283 y(If)27 b(you)i(cr)o(eate)e(a)g(graphics)h(context)h
+(\(GC\))f(and)f(shar)o(e)h(it)g(to)h(paint)f(onto)h(several)e
+(drawables,)596 2374 y(make)k(sur)o(e)f(all)i(of)f(them)h(have)f(the)g
+(same)g(visual)h(and)f(colormap)g(for)h(which)g(the)f(GC)h(was)596
+2465 y(de\002ned.)22 b(The)i(same)g(applies)f(if)g(you)h(want)g(to)g
+(copy)g(an)g(ar)o(ea)d(fr)o(om)j(a)f(pixmap)g(to)h(a)f(window;)596
+2556 y(both)e(must)g(have)g(the)f(same)h(visual)g(and)f(colormap)596
+2689 y(If)f(you)h(ar)o(e)f(not)h(sur)o(e)f(that)h(your)g(code)f(is)i
+(doing)f(this)h(corr)o(ectly)-9 b(,)18 b(please)h(ask)h(politely)g(on)h
+(one)f(of)596 2781 y(the)j(GNOME)g(development)h(mailing)g(lists)g(for)
+f(someone)h(to)g(test)f(it)h(with)g(a)f(video)g(car)o(d)f(that)596
+2872 y(supports)i(this)h(featur)o(e.)e(That)h(person)g(will)h(likely)g
+(know)h(how)f(to)f(\002x)h(the)f(pr)o(oblem)g(and)g(will)596
+2963 y(tell)c(you)i(about)e(it.)197 3392 y Fi(Unix-related)35
+b(Issues)596 3543 y Fl(Check)20 b(the)g(r)o(eturn)g(values)f(of)h
+Fj(all)h Fl(system)g(calls)f(that)g(your)g(pr)o(ogram)g(makes.)g
+(Remember)g(that)596 3634 y(a)e(lot)h(of)g(system)h(calls)f(can)f(be)h
+(interr)o(upted)g(\(i.e.)f(the)h(call)f(will)i(r)o(eturn)e(-1)g(and)h
+(errno)g(will)g(be)g(set)596 3726 y(to)i(EINTR\))f(and)g(must)i(be)e(r)
+o(estarted.)596 3859 y(Do)f(not)h(assume,)f(for)g(example,)f(that)h
+Fk(write\(2\))f Fl(will)h(write)g(the)h(whole)g(buf)o(fer)d(at)i(a)f
+(time;)h(you)596 3950 y(have)i(to)g(check)h(the)g(r)o(eturn)e(value,)h
+(which)h(indicates)g(the)f(number)h(of)g(bytes)f(written,)h(and)f(try)
+596 4041 y(again)26 b(until)h(it)g(is)f(zer)o(o.)g(If)g(the)g(r)o
+(eturn)g(value)g(is)h(-1,)e(r)o(emember)g(to)i(check)g(errno)f(and)g
+(handle)596 4133 y(the)20 b(err)o(or)g(appr)o(opriately)-9
+b(.)596 4265 y(If)16 b(your)i(application)f(calls)g Fk(fork\(2\))f
+Fl(without)j(calling)e Fk(execve\(2\))p Fl(,)f(r)o(emember)g(that)h
+(the)h(child)596 4357 y(pr)o(ocess)g(cannot)h(make)g(any)g(X)g(calls.)f
+(Y)-8 b(ou)20 b(can)f(usually)g(diagnose)g(this)h(pr)o(oblem)e(because)
+g(you)596 4448 y(get)i(an)h(obscur)o(e)f(Xlib)h(err)o(or)f(message.)596
+4581 y(Please)15 b(r)o(ead)f(a)h(book)i(like)f(\223Advanced)d(pr)o
+(ogramming)j(in)h(the)f(Unix)f(envir)o(onment\224,)h(by)g(Stevens,)596
+4672 y(to)k(learn)f(about)g(all)h(these)f(issues)h(and)g(to)g(make)f
+(sur)o(e)g(that)g(your)h(pr)o(ograms)f(use)h(the)g(Unix)f(API)596
+4764 y(corr)o(ectly)-9 b(.)25 b(If)h(you)h(ar)o(e)e(not)i(sur)o(e)e
+(you)i(ar)o(e)e(using)i(an)f(Unix)h(call)f(corr)o(ectly)-9
+b(,)25 b(please)h(ask)g(on)h(the)596 4855 y(mailing)21
+b(lists.)197 5328 y Fn(Security)38 b(Considerations)p
+Black 3642 5876 a Fj(9)p Black eop
+%%Page: 10 10
+10 9 bop Black 197 -132 a Fj(GNOME)20 b(Pr)o(ogramming)f(Guidelines)p
+Black 596 380 a Fl(Security)28 b(is)h(a)f(complex)h(issue,)f(and)h
+(this)g(section)g(cannot)g(nearly)g(explain)f(everything)h(that)596
+471 y(ther)o(e)c(is)h(to)g(it.)g(W)-8 b(e)26 b(will)g(try)g(to)g(point)
+h(out)f(the)g(most)g(common)i(situations)e(wher)o(e)g(your)g(pr)o(o-)
+596 562 y(grams)20 b(need)h(to)g(be)f(concerned)h(about)f(security)-9
+b(.)596 695 y(It)25 b(is)h(very)f(easy)h(to)g(cr)o(eate)d(security)j
+(holes)g(by)g(incorr)o(ectly)f(cr)o(eating)g(temporary)g(\002les)h
+(under)596 786 y Fk(/tmp)p Fl(.)e(Y)-8 b(ou)27 b(must)f(guarantee)e
+(that)i(the)f(\002les)h(you)g(will)h(use)e(do)h(not)g(exist)f(at)g(the)
+h(time)g(of)f(cr)o(e-)596 878 y(ation.)e(Using)h(an)g("unpr)o
+(edictable")e(or)h("unique")h(\002lename)g(is)g(not)g(enough;)h(you)f
+(must)g(guar)o(-)596 969 y(antee)19 b(that)g(a)g(\002le)h(with)h(that)e
+(name)h(will)g(not)g(be)g(cr)o(eated)d(by)j(someone)h(else)e(between)h
+(the)g(time)596 1060 y(you)i(compute)g(the)g(name)f(and)h(you)g
+(actually)f(cr)o(eate)f(the)i(\002le)g(\(basically)-9
+b(,)20 b(the)i(attack)f(involves)596 1152 y(a)f(second)h(party)f(cr)o
+(eating)g(a)g(symlink)i(to)f(a)g(\002le)g(they)g(want)g(to)g
+(overwrite\).)596 1285 y(Fortunately)-9 b(,)20 b(this)i(is)f(easy)f(to)
+h(do.)g(Y)-8 b(ou)22 b(can)e(use)h(the)g(following)h(piece)e(of)h
+(code:)596 1450 y Fk(char)44 b(*filename;)596 1532 y(int)g(fd;)596
+1696 y(do)g({)596 1779 y(filename)f(=)i(tempnam)e(\(NULL,)h("foo"\);)
+596 1861 y(fd)g(=)h(open)f(\(filename,)f(O_CREAT)h(|)g(O_EXCL)g(|)h
+(O_TRUNC)e(|)i(O_RDWR,)f(0600\);)596 1943 y(})g(while)g(\(fd)g(==)h
+(-1\);)596 2200 y Fl(Remember)23 b(to)i Fk(free\(\))d
+Fl(the)i(\002lename)g(and)f Fk(close\(\))g Fl(and)g Fk(unlink\(\))g
+Fl(the)h(\002le)f(after)g(you)h(ar)o(e)596 2291 y(done.)17
+b(If)g(you)h(want)g(to)f(use)h(the)g(Standar)o(d)d(I/O)j(library)-9
+b(,)16 b(you)i(can)f(use)h Fk(fdopen\(\))e Fl(to)i(transform)596
+2382 y(the)i(\002le)h(descriptor)g(into)g(a)g(FILE)f(*,)h(or)g(you)g
+(can)f(use)h Fk(tmpfile\(\))e Fl(to)j(do)e(it)h(in)h(one)f(step.)596
+2515 y(T)-7 b(ry)22 b(not)h(to)g(use)g(\002xed-size)f(buf)o(fers.)f
+(Fixed-size)g(buf)o(fers)g(for)i(strings)h(ar)o(e)d(a)h(typical)h(sour)
+o(ce)f(of)596 2606 y(exploitable)e(holes)h(that)g(can)g(lead)f(to)h
+(obscur)o(e)f(bugs.)h(If)f(you)i(absolutely)f(must)g(use)g
+(\002xed-size)596 2698 y(buf)o(fers)27 b(for)h(strings,)h(please)f(use)
+g(the)h Fk(g_snprintf\(\))d Fl(function)k(to)f(specify)f(the)g(maximum)
+596 2789 y(size)20 b(of)h(your)g(buf)o(fer)-6 b(.)596
+2922 y(Glib)27 b(pr)o(ovides)g(the)g(very)g(convenient)g
+Fk(g_strdup_printf\(\))e Fl(function,)i(which)h(works)g(just)596
+3013 y(like)21 b Fk(sprintf\(\))e Fl(but)i(will)g(automatically)g
+(allocate)f(a)h(buf)o(fer)e(of)i(the)g(corr)o(ect)f(size.)g(The)h(r)o
+(eturn)596 3104 y(value)29 b(of)h(this)h(function)g(should)g(be)f(r)o
+(eleased)e(using)j Fk(g_free\(\))p Fl(.)e(This)h(is)h(often)f(mor)o(e)g
+(con-)596 3196 y(venient)d(to)g(use)g(than)g Fk(g_snprintf\(\))p
+Fl(,)e(as)i(it)g(does)g(not)g(limit)h(the)f(size)g(of)g(strings)h(that)
+f(your)596 3287 y(pr)o(ogram)20 b(can)g(handle.)596 3420
+y(If)15 b(you)h(want)g(to)g(concatenate)f(a)h(gr)o(oup)f(of)h(strings)h
+(together)-6 b(,)15 b(you)i(can)e(use)h(the)g Fk(g_strconcat\(\))596
+3511 y Fl(function,)22 b(which)h(takes)e(a)h(variable-length)f(list)h
+(of)g(strings)h(and)f(a)f(NULL)g(pointer)h(as)g(the)g(last)596
+3603 y(ar)o(gument.)596 3735 y Fj(Under)33 b(no)h(cir)o(cumstance)f
+Fl(cr)o(eate)f(a)i(GTK+)g(pr)o(ogram)f(that)h(is)g(setuid)g(r)o(oot.)g
+(The)g(GTK+)g(and)596 3827 y(GNOME)d(libraries)f(ar)o(e)g(big)i(and)f
+(complex,)g(and)g(they)g(have)g(not)h(been)f(audited)f(for)h(secu-)596
+3918 y(rity)-9 b(.)21 b(In)i(any)f(case,)f(you)i(would)f(not)h(want)f
+(to)h(have)e(such)i(a)e(big)i(piece)e(of)h(code)g(be)g(setuid)g(r)o
+(oot)596 4009 y(anyways.)j(It)g(you)h(must)g(absolutely)g(use)g(r)o
+(oot)f(privileges)g(for)h(something,)h(write)e(your)h(pr)o(o-)596
+4101 y(gram)i(so)h(that)f(the)h(user)g(interface)e(is)i(in)g(a)f
+(normal,)h(non-privileged)f(pr)o(ocess)g(and)h(cr)o(eate)d(a)596
+4192 y(helper)c(pr)o(ogram)f(that)h(is)h(setuid)f(and)g(performs)g(the)
+h(`danger)o(ous')f(operations.)g(Also,)h(please)596 4283
+y(notify)k(the)f(GNOME)g(development)g(mailing)i(lists)f(about)f(this)h
+(and)f(r)o(equest)g(that)g(someone)596 4375 y(perform)20
+b(a)g(security)h(audit)f(on)i(your)f(helper)f(pr)o(ogram.)596
+4508 y(In)25 b(general,)g(if)g(you)h(ar)o(e)e(not)i(sur)o(e)f(that)g
+(something)i(may)f(cr)o(eate)d(a)i(security)h(risk,)f(please)g(ask)596
+4599 y(on)c(the)g(GNOME)f(development)h(mailing)h(lists)f(about)g(it.)
+596 4732 y(Y)-8 b(ou)27 b(can)f(r)o(ead)f(mor)o(e)h(about)g(some)h
+(security)g(issues)g(that)f(you)h(might)g(\002nd)g(while)g(pr)o(ogram-)
+596 4823 y(ming)32 b(Unix)f(applications)g(in)h(W)-5
+b(ietse)32 b(V)-9 b(enema's)31 b(Murphy's)g(law)h(and)e(computer)i
+(security)596 4914 y(\(http://www)-8 b(.\002sh.com/security/murphy)f
+(.html\).)36 b(Ther)o(e)d(ar)o(e)f(other)h(security)h(papers)e(in)596
+5006 y(that)20 b(site)h(\(http://www)-8 b(.\002sh.com/security\))23
+b(that)e(you)g(might)h(\002nd)f(inter)o(esting.)197 5396
+y Fn(P)l(erf)m(ormance)p Black 197 5876 a Fj(10)p Black
+eop
+%%Page: 11 11
+11 10 bop Black 2495 -132 a Fj(GNOME)20 b(Pr)o(ogramming)f(Guidelines)p
+Black 596 380 a Fl(Do)25 b(not)h(r)o(ead)d(this)j(section)g(until)g
+(you)f(have)g(made)f(sur)o(e)h(that)g(your)g(pr)o(ogram)f(is)i(corr)o
+(ect,)d(i.e.)596 471 y(when)i(you)g(ar)o(e)e(sur)o(e)g(that)i(it)g
+(works)g(corr)o(ectly)f(and)g(has)g(no)h(bugs.)g(It)f(is)h(mor)o(e)f
+(important)h(for)596 562 y(your)f(code)f(to)h(be)g(corr)o(ect)f(than)h
+(to)g(be)g(fast.)f(A)g(slow)-8 b(,)25 b(corr)o(ect)e(pr)o(ogram)g(is)h
+(better)f(than)h(a)g(fast,)596 654 y(buggy)d(one.)596
+786 y(If)c(you)i(want)g(to)f(optimize)h(your)g(pr)o(ogram,)e(the)h
+(\002rst)h(step)f(is)h(to)f(pr)o(o\002le)g(the)h(pr)o(ogram)e(r)o
+(unning)596 878 y(with)25 b(r)o(eal)e(life)h(data)f(and)h(collect)h(pr)
+o(o\002ling)g(information.)g(This)g(will)g(help)f(you)h(pinpoint)h(the)
+596 969 y(actual)17 b(hot)i(spots)g(that)g(need)f(optimizing.)h(It)g
+(is)g(important)f(to)h(never)f(optimize)h(ahead)e(of)i(time)596
+1060 y(if)g(you)h(do)g(not)h(have)e(a)g(clear)g(idea)g(on)h(what)g(the)
+g(pr)o(oblem)g(is.)g(Y)-8 b(ou)20 b(might)h(end)f(up)g(losing)h(time)
+596 1152 y(in)h(speeding)h(up)f(a)g(r)o(outine)h(that)f(is)h(not)g
+(causing)g(the)g(speed)f(bottleneck)g(and)h(you)g(might)g(ob-)596
+1243 y(fuscate)17 b(the)h(r)o(outine)g(as)g(a)g(r)o(esult.)f(This)i
+(could)f(r)o(educe)e(code)i(r)o(eadability)f(and)g(maintainability)596
+1334 y(with)k(no)g(visible)g(gain)g(in)h(speed.)596 1467
+y(Simple)28 b(code)h(is)g(good)g(because)f(it)h(is)h(easy)e(to)h
+(understand)g(and)f(easy)h(to)g(maintain.)g(If)f(you)596
+1559 y(can)19 b(write)i(simple)f(code)g(that)h(is)f(also)h(poweful)f
+(and)g(fast,)f(all)h(the)h(better)-6 b(.)19 b(If)h(you)h(have)e(a)h
+(smart)596 1650 y(piece)c(of)i(code)f(that)g(is)h(not)g(easy)f(to)h
+(follow)-8 b(,)19 b(please)d(document)i(it)g(so)g(that)f(people)h(do)f
+(not)h(br)o(eak)596 1741 y(it)i(accidentally)-9 b(.)596
+1874 y(Do)29 b(not)h(write)f(code)g(that)g(is)h(har)o(d)e(to)i(r)o(ead)
+d(and)i(maintain)g(if)g(it)h(is)f(only)h(to)g(make)f(the)g(code)596
+1965 y(faster)-6 b(.)19 b(Look)i(for)g(a)f(nice)h(and)f(clean)h
+(algorithm)g(instead,)f(and)h(implement)g(it)g(cleanly)-9
+b(.)596 2098 y(Doing)26 b(a)f(good)g(job)h(in)g(the)f(general)g(case)f
+(is)i(often)f(better)f(than)i(having)f(many)h(special)e(cases)596
+2190 y(as)d(well.)i(Only)g(pr)o(ovide)e(special)h(cases)g(when)h(you)g
+(have)f(identi\002ed)g(weak)g(spots)h(in)f(the)h(pr)o(o-)596
+2281 y(gram.)197 2585 y Fi(List)34 b(Mana)o(g)q(ement)h(in)e(Glib)596
+2736 y Fl(A)-8 b(void)15 b(using)i(constr)o(ucts)g(that)f(will)g(lead)f
+(to)h(slow)h(algorithms.)f(If)g(you)g(use)g Fk
+(g_list_insert_sorted\(\))596 2827 y Fl(or)h Fk(g_list_append\(\))e
+Fl(car)o(elessly)-9 b(,)16 b(you)i(can)f(easily)h(get)f(an)g(algorithm)
+i(that)e(r)o(uns)h(in)g(time)g(pr)o(o-)596 2919 y(portional)e(to)g
+(O\(n)1179 2886 y Fg(2)1204 2919 y Fl(\).)f(Usually)h(you)g(can)g(cr)o
+(eate)e(the)i(list)g(backwar)o(ds,)e(using)j Fk(g_list_prepend\(\))p
+Fl(,)596 3010 y(and)j(r)o(everse)f(it)h(when)i(you)f(ar)o(e)e(done)i
+(by)f(using)i Fk(g_list_reverse\(\))p Fl(.)17 b(This)22
+b(is)e(a)h(O\(n\))f(opera-)596 3101 y(tion.)f(And)f(if)g(you)h(need)f
+(a)g(sorted)h(list,)f(you)i(can)e(cr)o(eate)e(it)j(by)g(pr)o(epending)f
+(elements)g(and)g(then)596 3193 y(r)o(un)j Fk(g_list_sort\(\))d
+Fl(when)k(you)f(ar)o(e)e(done.)596 3326 y(If)e(you)i(need)f(a)g(list)g
+(to)h(be)f(sorted)g(at)g(all)g(times,)g(you)h(may)f(be)g(better)g
+(served)f(by)i(a)e(tr)o(ee)g(str)o(uctur)o(e)596 3417
+y(or)23 b(a)f(tr)o(ee/list)h(hybrid.)g(If)f(you)i(need)e(to)i(constr)o
+(uct)f(a)g(list)h(by)f(appending)f(nodes)i(to)f(it,)g(keep)f(a)596
+3508 y(pointer)g(to)g(the)g(tail)f(of)h(the)g(list)g(and)f(update)g(it)
+h(as)f(appr)o(opriate;)f(this)j(will)f(let)g(you)g(append)f(or)596
+3600 y(pr)o(epend)e(a)h(node)h(in)g(constant)h(time.)197
+4073 y Fn(Localization)596 4236 y Fl(GNOME)31 b(is)h(intended)g(to)g(r)
+o(un)g(on)h(dif)o(fer)o(ent)c(locales)j(and)f(languages,)h(and)f(so)h
+(your)g(code)596 4327 y(should)c(take)f(this)h(into)g(account.)f(Y)-8
+b(ou)29 b(do)e(not)h(have)f(to)h(localize)f(your)h(pr)o(ograms;)e(you)i
+(just)596 4418 y(have)20 b(to)h(make)f(them)i(translatable)d(and)i
+(localizable.)596 4551 y(Y)-8 b(ou)22 b(should)g(r)o(ememeber)e(that)h
+(dif)o(fer)o(ent)f(human)h(languages)h(have)f(dif)o(fer)o(ent)e
+(grammars,)h(so)596 4642 y(you)26 b(should)g(not)h(make)e(assumptions)i
+(on)g(how)g(sentences)f(ar)o(e)e(formed.)h(This)h(is)g(important)596
+4734 y(when)21 b(building)g(strings)h(fr)o(om)e(separate)g(parts,)g
+(for)g(example.)596 4867 y(Concatenation)j(is)h(usually)g(not)g(the)g
+(corr)o(ect)e(way)i(to)g(build)f(a)g(string)i(to)e(be)h(pr)o(esented)e
+(to)i(the)596 4958 y(user)32 b(This)h(usually)f(leads)g(to)h(messages)g
+(that)f(cannot)h(be)f(translated)g(corr)o(ectly)f(to)i(all)f(lan-)596
+5049 y(guages,)20 b(so)h(try)g(to)g(use)g Fk(g_strdup_printf\(\))d
+Fl(instead)i(of)h(concatenation.)g(For)g(example,)596
+5214 y Fk(/*)44 b(Not)g(very)g(good)h(way)f(*/)596 5297
+y(char)g(*message)f(=)i(g_strconcat)e(\(_\("Hello,)g("\),)820
+5379 y(name,)820 5461 y(_\(",)h(would)g(you)g(like)g(fries)g(with)g
+(that?"\),)p Black 3605 5876 a Fj(1)-5 b(1)p Black eop
+%%Page: 12 12
+12 11 bop Black 197 -132 a Fj(GNOME)20 b(Pr)o(ogramming)f(Guidelines)p
+Black 820 380 a Fk(NULL\);)596 544 y(/*)44 b(Better)g(way)g(*/)596
+626 y(char)g(*message)f(=)i(g_strdup_printf)d(\(_\("Hello,)h(\045s,)i
+(would)f(you)g(like)g(fries)g(with)g(that?"\),)640 708
+y(name\);)596 965 y Fl(This)20 b(will)g(allow)g(the)g(translator)g(to)g
+(move)g(the)g(\045s)g(ar)o(ound)f(if)g(the)h(language's)g(grammar)f(he)
+h(is)596 1056 y(working)h(on)h(r)o(equir)o(es)e(it.)596
+1189 y(Remember)j(that)h(not)h(all)f(languages)f(form)h(plurals)g(by)g
+(appending)f(an)h(\223s\224)f(to)h(wor)o(ds.)g(Also,)596
+1280 y(sentence)c(str)o(uctur)o(es)h(may)g(change)f(with)i(plurals.)e
+(Please)g(look)i(at)e(this)i(example:)596 1446 y Fk(/*)44
+b(Not)g(very)g(good)h(way)f(*/)596 1528 y(printf)f(\(_\("\045d)h(happy)
+g(monkey\045s)g(bouncing)f(on)i(the)f(bed."\),)596 1610
+y(num_monkeys,)596 1692 y(\(num_monkeys)e(>)j(1\))f(?)h("s",)f(""\);)
+596 1857 y(/*)g(Better)g(way)g(*/)596 1939 y(printf)f(\(\(num_monkeys)g
+(>)i(1\))596 2021 y(?)f(_\("\045d)g(happy)g(monkeys)g(bouncing)f(on)i
+(the)f(bed."\),)596 2103 y(:)g(_\("\045d)g(happy)g(monkey)g(bouncing)f
+(on)i(the)f(bed."\)\);)596 2360 y Fl(This)31 b(is)g(r)o(equir)o(ed)e
+(since)i(the)g(plural)f(will)h(be)g(formed)f(in)h(dif)o(fer)o(ent)e
+(ways)i(in)g(dif)o(fer)o(ent)d(lan-)596 2451 y(guages,)20
+b(and)g(the)h(whole)h(sentence's)f(str)o(uctur)o(e)f(may)h(change.)596
+2584 y(If)c(your)i(pr)o(ogram)f(prints)g(dates)g(or)g(times,)h(please)e
+(use)i(the)f Fk(strftime\(\))f Fl(to)h(format)g(them)h(into)596
+2675 y(strings.)26 b(This)g(will)h(take)e(car)o(e)f(of)i(using)g(the)g
+(pr)o(oper)f(date)g(and)g(time)h(r)o(epr)o(esentation)e(for)i(the)596
+2767 y(user)6 b('s)24 b(pr)o(eferr)o(ed)c(locale.)j(Also,)h(if)g(your)g
+(pr)o(ogram)f(must)h(generate)f(a)g(visual)h(r)o(epr)o(esentation)596
+2858 y(of)g(a)f(calendar)-6 b(,)23 b(r)o(emember)g(that)h(in)g(some)h
+(countries)g(consider)f(Monday)g(to)g(be)g(the)g(\002rst)h(day)596
+2949 y(of)20 b(a)h(week,)f(instead)g(of)h(Sunday)-9 b(.)20
+b(Y)-8 b(our)22 b(pr)o(ogram)e(should)h(allow)g(both)h(forms)f(of)f
+(calendars.)596 3082 y(If)g(your)i(pr)o(ogram)e(deals)g(with)i(measur)o
+(ements,)f(please)f(make)h(sur)o(e)f(it)i(supports)f(both)h(Metric)596
+3173 y(and)e(U.S.)f(systems.)197 3563 y Fn(Binar)q(y)39
+b(Compatibility)d(in)k(Libraries)596 3726 y Fl(For)17
+b(stable)f(and)g(r)o(eleased)f(libraries,)h(it)h(is)g(very)f(important)
+i(to)f(try)f(to)i(pr)o(eserve)d(binary)h(compat-)596
+3818 y(ibility)22 b(acr)o(oss)g(major)g(r)o(evisions)g(of)g(the)h
+(code.)e(Library)g(developers)g(should)i(try)f(not)h(to)f(alien-)596
+3909 y(ate)j(users)i(by)g(making)g(fr)o(equent)f(binary)g(incompatible)
+h(changes)g(on)g(pr)o(oduction)g(libraries.)596 4000
+y(Of)18 b(course,)h(libraries)f(that)h(ar)o(e)f(being)h(developed)f(or)
+h(ar)o(e)f(labeled)f(as)i(not)h(done)f(can)f(change)h(as)596
+4092 y(much)i(as)f(they)h(need.)596 4224 y(A)35 b(library)g(typically)h
+(exports)f(a)g(number)h(of)g(interfaces.)e(These)i(include)f(r)o
+(outine)h(names,)596 4316 y(the)24 b(signatur)o(es)f(or)h(pr)o
+(ototypes)g(of)g(these)g(r)o(outines,)g(global)g(variables,)f(str)o
+(uctur)o(es,)g(str)o(uctur)o(e)596 4407 y(\002elds)c(\(both)h(the)g
+(types)f(and)g(the)h(meaning)g(of)f(these\),)g(the)h(meaning)g(of)g
+(enumeration)g(values,)596 4498 y(and)i(the)g(semantics)h(of)g(the)g
+(\002les)g(that)f(ar)o(e)g(cr)o(eated)e(by)j(the)g(library)-9
+b(.)21 b(T)-8 b(o)24 b(keep)e(binary)g(compat-)596 4590
+y(ibility)27 b(means)f(that)h(these)f(interfaces)g(will)h(not)g(be)f
+(changed.)g(Y)-8 b(ou)28 b(can)e(add)f(new)i(interfaces)596
+4681 y(without)18 b(br)o(eaking)e(binary)g(compatibility)-9
+b(,)17 b(but)g(you)g(cannot)g(change)g(the)g(existing)g(ones,)h(since)
+596 4772 y(old)i(pr)o(ograms)h(will)g(no)h(longer)f(r)o(un)g(corr)o
+(ectly)-9 b(.)596 4905 y(This)33 b(section)g(includes)g(a)f(number)h
+(of)f(hints)i(on)f(how)h(you)f(can)f(make)g(your)h(library)f(code)596
+4997 y(binary)20 b(compatible)h(with)g(old)g(versions)h(of)f(itself.)
+596 5129 y(Keeping)27 b(binary)h(compatibility)g(means)g(that)f(pr)o
+(ograms)g(and)g(object)h(\002les)g(that)f(wer)o(e)g(com-)596
+5221 y(piled)g(against)h(a)g(pr)o(evious)g(version)g(of)g(the)h(code)e
+(will)i(continue)g(to)g(work)f(without)i(r)o(ecom-)596
+5312 y(piling)h(if)f(the)h(library)f(is)g(r)o(eplaced.)f(A)h(detailed)f
+(description)i(of)f(this)h(can)f(be)g(found)h(in)g(the)596
+5403 y Fk(\(libtool\)Interfaces)17 b Fl(info)k(node)g(in)g(the)g(GNU)g
+(libtool)h(documentation.)p Black 197 5876 a Fj(12)p
+Black eop
+%%Page: 13 13
+13 12 bop Black 2495 -132 a Fj(GNOME)20 b(Pr)o(ogramming)f(Guidelines)p
+Black 197 384 a Fi(Priv)n(ate)34 b(Inf)n(ormation)f(in)g(Structures)596
+535 y Fl(In)16 b(the)g(GNOME)g(system,)h(it)f(is)g(very)g(common)h
+(task)f(to)h(cr)o(eate)d(a)i(new)g(GtkObject)h(by)f(cr)o(eating)f(a)596
+626 y(str)o(uctur)o(e,)h(whose)i(\002rst)f(member)g(is)h(the)f(class)g
+(this)h(object)f(inherits)h(fr)o(om,)f(and)g(then)g(a)g(number)596
+718 y(of)j(instance)h(variables)f(that)h(ar)o(e)e(added)g(after)h(this)
+h(\002rst)g(member)-6 b(.)596 850 y(This)27 b(design)h(scheme)f
+(usually)h(leads)f(to)g(code)g(that)g(is)h(har)o(d)e(to)i(update)e(and)
+h(change:)g(if)g(the)596 942 y(internal)k(state)f(that)h(the)g(object)h
+(needs)f(to)g(maintain)g(is)h(extended,)e(pr)o(ogrammers)g(need)h(to)
+596 1033 y(r)o(esort)18 b(to)h(various)f(hacks)h(to)g(keep)f(the)h
+(size)f(of)h(the)g(str)o(uctur)o(es)f(the)h(same.)f(That)g(is,)h(it)g
+(is)g(har)o(d)f(to)596 1124 y(add)23 b(new)h(\002elds)g(to)h(the)f
+(public)g(str)o(uctur)o(es)g(without)i(br)o(eaking)d(binary)h
+(compatibility)-9 b(,)25 b(since)596 1216 y(the)20 b(str)o(uctur)o(e)h
+(\002elds)g(may)f(change)h(and)f(the)h(str)o(uctur)o(es)g(may)f(change)
+h(size.)596 1349 y(W)-8 b(e)27 b(ther)o(efor)o(e)e(suggest)j(a)f
+(strategy)f(that)h(developers)g(may)g(adopt)g(when)g(cr)o(eating)g(new)
+g(ob-)596 1440 y(jects.)16 b(This)g(strategy)g(will)h(ensur)o(e)f
+(binary)g(compatibility)g(and)g(at)g(the)g(same)g(time)g(will)h(impr)o
+(ove)596 1531 y(the)j(r)o(eadability)g(and)g(maintainability)h(of)g
+(the)g(code.)596 1664 y(The)15 b(idea)h(is)g(that)g(for)g(any)g(given)g
+(object,)g(the)g(pr)o(ogrammer)f(should)i(cr)o(eate)d(thr)o(ee)h
+(\002les:)i(the)f(\002rst)596 1755 y(one)24 b(contains)g(the)g(public)f
+(contract)h(between)f(the)h(library)f(and)g(the)h(user)f(\(this)h(is)g
+(the)g(header)596 1847 y(\002le)e(that)g(gets)g(installed)h(in)f(the)h
+(system\);)f(the)g(second)h(one)f(contains)h(the)g(implementation)g(of)
+596 1938 y(the)e(object;)h(and)f(the)h(thir)o(d)g(\002le)f(contains)i
+(a)e(str)o(uctur)o(e)g(de\002nition)i(for)e(the)h(internal)g(or)g
+(private)596 2029 y(\002elds)e(that)h(do)g(not)g(need)g(to)g(be)f(in)h
+(the)g(public)g(str)o(uctur)o(e.)596 2162 y(The)j(public)g(API)g(str)o
+(uctur)o(e)g(would)h(include)f(a)g(private)f(pointer)i(element)f(that)g
+(would)h(point)596 2254 y(to)18 b(the)g(per)o(-instance)f(private)h
+(data.)e(The)j(implementation)g(r)o(outines)f(would)h(der)o(efer)o
+(ence)c(this)596 2345 y(pointer)23 b(to)g(access)g(private)f(data;)f
+(the)i(pointer)h(of)f(course)g(points)h(to)f(a)f(str)o(uctur)o(e)h
+(that)g(is)g(allo-)596 2436 y(cated)c(privately)-9 b(.)596
+2569 y(For)21 b(example,)g(imagine)h(we)g(ar)o(e)e(cr)o(eating)h(a)g
+(GnomeFr)o(ob)h(object.)g(The)f(widget)h(implementa-)596
+2660 y(tion)f(will)h(be)e(split)h(in)h(thr)o(ee)d(\002les:)596
+2876 y Ff(T)-9 b(able)19 b(1.)h(Files)f(that)h(make)f(up)h(the)g
+(sample)f(GnomeFrob)h(widget)p 596 2984 3099 4 v 596
+2984 V 596 3100 4 117 v 624 3048 a Fe(Filename)p 2143
+3100 V 1187 w(Contents)p 3691 3100 V 596 3103 3099 4
+v 596 3103 V 596 3220 4 117 v 624 3167 a Fk(gnome-frob.h)p
+2143 3220 V 1007 w Fl(GnomeFr)o(ob)i(public)f(API)p 3691
+3220 V 596 3223 3099 4 v 596 3223 V 596 3339 4 117 v
+624 3287 a Fk(gnome-frob.c)p 2143 3339 V 1007 w Fl(GnomeFr)o(ob)h
+(object)f(implementation)p 3691 3339 V 596 3342 3099
+4 v 596 3342 V 596 4098 4 756 v 624 3406 a Fk(gnome-frob-private.h)p
+2143 4098 V 647 w Fl(GnomeFr)o(ob)h(object)f(private)2146
+3498 y(implementation)h(data.)e(Y)-8 b(ou)21 b(might)h(want)f(to)2146
+3589 y(use)g(this)h(if)e(you)i(plan)e(on)i(sharing)f(the)g(private)2146
+3680 y(data)f(acr)o(oss)g(various)h(C)f(\002les.)h(If)g(you)g(limit)h
+(the)2146 3772 y(use)f(of)g(this)g(private)f(information)i(to)f(a)f
+(single)2146 3863 y(\002le,)h(you)g(do)g(not)h(need)e(this,)h
+(de\002ning)h(the)2146 3954 y(str)o(uctur)o(e)f(in)g(the)g
+(implementation)h(\002le)f(will)2146 4046 y(achieve)f(the)h(same)g(ef)o
+(fect.)p 3691 4098 V 596 4101 3099 4 v 596 4101 V 596
+4410 a Ff(Example)d(1.)i(Sample)e Fd(gnome-frob.h)h Ff(public)g(API.)
+596 4576 y Fk(typedef)43 b(struct)h(_GnomeFrob)f(GnomeFrob;)596
+4658 y(typedef)g(struct)h(_GnomeFrobPrivate)e(GnomeFrobPrivate;)596
+4822 y(struct)h(_GnomeFrob)g({)909 4904 y(GtkObject)h(parent_object;)
+909 5069 y(int)89 b(public_value;)909 5151 y(GnomeFrobPrivate)42
+b(*priv;)596 5233 y(})i(GnomeFrob;)596 5397 y(GnomeFrob)f
+(*gnome_frob_new)f(\(void\);)p Black 3601 5876 a Fj(13)p
+Black eop
+%%Page: 14 14
+14 13 bop Black 197 -132 a Fj(GNOME)20 b(Pr)o(ogramming)f(Guidelines)p
+Black 596 380 a Fk(void)313 b(gnome_frob_frobate)41 b(\(GnomeFrob)j
+(*frob\);)596 719 y Ff(Example)18 b(2.)i(Sample)e Fd
+(gnome-frob-private.h)596 884 y Fk(typedef)43 b(struct)h({)954
+967 y(gboolean)g(frobbed;)596 1049 y(};)596 1388 y Ff(Example)18
+b(3.)i(Sample)p Fd(gnome-frob.c)c Ff(implementation.)596
+1554 y Fk(void)44 b(gnome_frob_frobate)d(\(GnomeFrob)j(*frob\))596
+1636 y({)954 1718 y(g_return_if_fail)e(\(frob)i(!=)h(NULL\);)596
+1800 y(g_return_if_fail)d(\(GNOME_IS_FROB)g(\(frob\)\);)596
+1965 y(frob->priv->frobbed)f(=)k(TRUE;)596 2047 y(})596
+2303 y Fl(Notice)19 b(the)g(use)h(of)f(str)o(uctur)o(e)g(pr)o
+(ototypes:)g(this)h(enables)f(the)g(compiler)g(to)h(do)f(mor)o(e)g
+(checking)596 2395 y(for)h(you)h(at)g(compile)g(time)g(about)g(the)g
+(types)f(being)h(used.)596 2527 y(This)c(scheme)g(is)g(useful)g(in)g
+(some)h(situations,)f(particularly)f(the)h(case)f(in)i(which)f(you)h
+(can)e(af)o(for)o(d)596 2619 y(to)27 b(stor)o(e)h(an)f(extra)g(pointer)
+h(per)f(object)h(instance.)f(If)g(this)i(is)f(not)g(possible)g(the)g
+(pr)o(ogrammer)596 2710 y(might)21 b(need)g(to)g(r)o(esort)f(to)h
+(other)g(workar)o(ounds)g(for)f(this)i(pr)o(oblem.)596
+2843 y(The)g(purpose)h(of)g(having)g(an)g(extra)f(private)f(header)h
+(\002le)h(for)g(the)g(private)f(str)o(uctur)o(es)g(is)h(to)h(al-)596
+2934 y(low)f(for)g(derived)f(classes)h(to)h(use)f(this)h(information.)g
+(Of)f(course,)g(good)h(pr)o(ogramming)f(prac-)596 3026
+y(tice)d(would)h(indicate)f(that)g(interfaces)f(or)i(access)f(methods)h
+(would)g(be)f(pr)o(ovided)f(pr)o(ecisely)h(to)596 3117
+y(keep)d(the)h(pr)o(ogrammer)g(fr)o(om)f(having)i(to)f(poke)g(into)h
+(the)f(private)f(str)o(uctur)o(es.)h(Y)-8 b(ou)19 b(should)g(try)596
+3208 y(to)26 b(achieve)f(a)g(balance)g(between)h(good)g(practice)f(and)
+h(pragmatism)f(when)i(cr)o(eating)e(private)596 3300
+y(str)o(uctur)o(es)20 b(and)g(public)h(access)f(methods.)596
+3432 y(Some)j(pr)o(oblems)h(might)g(arise,)f(for)h(example,)e(when)j
+(you)f(have)f(shipped)h(a)f(version)h(of)g(your)596 3524
+y(code)29 b(that)i(is)f(being)h(widely)f(used)g(and)g(you)h(want)f(to)h
+(extend)e(it.)h(Ther)o(e)g(ar)o(e)e(two)j(possible)596
+3615 y(solutions)22 b(for)f(this.)596 3748 y(The)d(\002rst)h(option)g
+(is)g(to)g(\002nd)g(a)f(pointer)g(\002eld)h(in)g(the)f(public)h(str)o
+(uctur)o(e)f(that)g(you)h(can)f(make)g(pri-)596 3839
+y(vate,)j(and)g(r)o(eplace)g(it)h(with)h(a)e(pointer)i(to)f(the)g
+(private)g(part)f(of)h(the)g(str)o(uctur)o(e.)g(This)g(pr)o(eserves)596
+3931 y(the)e(size)h(of)f(the)h(str)o(uctur)o(e,)f(since)h(for)g(the)f
+(purposes)h(of)g(GNOME,)f(pointers)h(can)g(be)f(assumed)596
+4022 y(to)26 b(be)h(all)f(of)g(the)h(same)f(size.)g(This)h(\002eld)g
+(can)f(be)g(made)g(to)h(point)g(to)g(the)g(private)f(part)f(of)i(the)
+596 4113 y(str)o(uctur)o(e)16 b(that)h(will)g(be)g(allocated)e(by)i
+(the)g(function)h(that)f(originally)g(cr)o(eated)e(the)i(public)g(str)o
+(uc-)596 4204 y(tur)o(e.)25 b(It)i(is)g(important)g(that)f(this)h
+(\002eld)g(is)g(not)g(called)f Fc(private)p Fl(,)f(as)h(this)h(is)g(a)f
+(C++)h(keywor)o(d)596 4296 y(and)e(will)i(cr)o(eate)d(pr)o(oblems)i
+(when)h(your)f(header)f(\002le)h(is)h(being)f(used)g(fr)o(om)g(C++)g
+(sour)o(ces)g(\227)596 4387 y(call)d(it)h Fc(priv)29
+b Fl(instead.)23 b(Of)h(course,)f(this)i(type)e(of)h(change)f(will)i
+(only)f(work)h(if)e(the)h(old)g(pointer)596 4478 y(\002eld)c(was)h(r)o
+(eally)f(being)i(used)e(for)h(internal)g(purposes)g(only;)h(if)e(users)
+h(of)g(the)g(library)g(had)f(had)596 4570 y(to)i(access)g(that)h
+(\002eld)f(for)h(any)f(purpose,)g(you)i(will)f(have)f(to)h(\002nd)g
+(another)f(\002eld)h(or)f(r)o(esort)g(to)h(a)596 4661
+y(dif)o(fer)o(ent)18 b(solution.)596 4794 y(If)e(your)h(original)h(str)
+o(uctur)o(e)e(was)h(a)g(derivative)e(of)i(GtkObject)h(and)e(ther)o(e)h
+(ar)o(e)e(no)j(pointer)f(\002elds)596 4885 y(that)24
+b(you)i(can)e(r)o(eplace,)f(you)i(can)f(use)h(the)g(GTK+)h(object)f
+(data)e(facility)i(instead.)f(This)h(allows)596 4977
+y(you)16 b(to)g(associate)f(arbitrary)g(data)f(pointers)j(to)f
+(objects.)g(Y)-8 b(ou)17 b(can)e(use)h(the)g Fk
+(gtk_object_set_data\(\))596 5068 y Fl(function)g(to)g(attach)f(values)
+h(or)g(str)o(uctur)o(es)f(to)h(your)g(object)h(and)e(then)h(you)g(can)g
+(use)g(the)g Fk(gtk_object_get_data\(\))596 5159 y Fl(to)35
+b(r)o(etrieve)e(back)h(those)i(values.)e(This)h(can)g(be)f(used)h(to)g
+(attach)f(a)g(private)g(str)o(uctur)o(e)g(to)h(a)596
+5251 y(GTK+)24 b(object.)f(This)h(is)g(not)h(as)e(ef)o(\002cient)f(as)i
+(the)f(pr)o(evious)g(appr)o(oach,)f(but)i(it)f(might)i(not)f(even)596
+5342 y(matter)34 b(for)i(your)f(particular)g(application)g(domain.)g
+(If)g(you)h(will)g(be)g(accessing)f(this)h(data)596 5433
+y(very)26 b(fr)o(equently)-9 b(,)26 b(you)h(can)f(set)h(and)f(get)h(it)
+g(using)g(quarks)g(instead)f(of)h(strings)h(by)e(using)i(the)p
+Black 197 5876 a Fj(14)p Black eop
+%%Page: 15 15
+15 14 bop Black 2495 -132 a Fj(GNOME)20 b(Pr)o(ogramming)f(Guidelines)p
+Black 596 380 a Fk(gtk_object_set_data_by_id\(\))11 b
+Fl(and)16 b Fk(gtk_object_get_data_by_id\(\))11 b Fl(functions,)17
+b(r)o(e-)596 471 y(spectively)-9 b(.)197 944 y Fn(Modifying)37
+b(Other)i(P)l(eople')-9 b(s)38 b(Code)596 1108 y Fl(GNOME)26
+b(is)i(a)e(team)h(pr)o(oject,)f(so)i(contributions)g(of)f(code)g(to)g
+(other)h(people's)f(pr)o(ograms)f(ar)o(e)596 1199 y(always)h(appr)o
+(eciated.)d(Please)j(follow)h(these)g(guidelines)g(when)g(modifying)g
+(other)g(people's)596 1290 y(code.)197 1595 y Fi(General)34
+b(Etiquette)596 1746 y Fl(Please)16 b(follow)i(the)f(same)g
+(indentation)h(style)g(that)f(the)g(original)h(code)e(uses.)h(The)h
+(original)f(code)596 1837 y(will)i(be)f(ar)o(ound)g(for)g(a)g(longer)h
+(time)g(than)g(you)g(may)g(want)f(to)h(dedicate)e(to)i(it,)g(so)g
+(keeping)g(your)596 1928 y(contributions)27 b(consistent)h(with)f(r)o
+(espect)e(to)h(indentation)h(is)f(mor)o(e)g(important)h(than)f(for)o
+(cing)596 2020 y(your)21 b(indentation)g(style)g(on)h(the)f(code.)596
+2152 y(Although)27 b(your)h(patches)e(may)h(implement)h(very)f(cool)g
+(functionality)-9 b(,)28 b(it)f(is)g(very)g(annoying)596
+2244 y(for)d(the)i(author)f(to)h(have)e(to)i(r)o(e-indent)e(your)i
+(code)f(befor)o(e)f(applying)h(the)g(patch)g(to)h(the)f(code)596
+2335 y(base.)19 b(So)i(if)g(the)g(original)g(code)f(looks)i(like)596
+2500 y Fk(int)596 2582 y(sum_plus_square_of_indices)40
+b(\(int)k(*values,)g(int)g(nvalues\))596 2665 y({)596
+2747 y(int)g(i,)g(total;)596 2911 y(total)g(=)g(0;)596
+3076 y(for)g(\(i)g(=)h(0;)f(i)h Fb(<)g Fk(nvalues;)e(i++\))596
+3158 y(total)h(+=)g(values[i])f(+)i(i)g(*)f(i;)596 3322
+y(return)f(total;)596 3404 y(})596 3579 y Fl(then)21
+b(do)g(not)g(add)f(a)g(function)i(that)e(looks)i(like)596
+3744 y Fk(int)44 b(sum_plus_cube_of_indices\(int)c(*values,)j(int)i
+(nvalues\))e({)685 3826 y(int)i(i,total;)685 3991 y(total=0;)685
+4155 y(for)g(\(i=0;i)p Fb(<)p Fk(nvalues;i++\))775 4237
+y(total+=values[i]+i*i*i;)685 4401 y(return)f(total;)596
+4484 y(})596 4658 y Fl(In)25 b(this)h(second)f(example,)f(indentation)i
+(and)e(brace)g(placement)h(do)g(not)h(match)f(the)g(original)596
+4749 y(code,)g(ther)o(e)h(ar)o(e)e(no)j(spaces)f(ar)o(ound)f
+(operators,)h(and)g(the)g(code)g(will)h(just)g(not)g(look)g(like)g(the)
+596 4841 y(original)h(one.)h(Please)f(follow)h(the)g(original)f(author)
+6 b('s)29 b(coding)g(style)g(and)f(your)g(patches)g(ar)o(e)596
+4932 y(mor)o(e)20 b(likely)h(to)g(be)g(accepted.)596
+5065 y(Please)h(do)i(not)g(\002x)f(bugs)h(with)g(quick)g(hacks)f(or)g
+(work-ar)o(ounds;)g(do)g(the)h(corr)o(ect)e(\002x)h(instead.)596
+5156 y(Also,)i(do)h(not)g(add)f(featur)o(es)f(as)h(hacks)g(or)h(with)h
+(code)e(that)g(is)h(not)h(extensible;)e(it)h(is)g(better)f(to)596
+5247 y(r)o(ework)i(the)h(original)h(code)e(to)i(be)e(extensible,)h(and)
+g(then)g(to)g(add)f(your)i(new)f(featur)o(e)e(using)596
+5339 y(that)20 b(code)h(as)f(a)g(framework.)p Black 3601
+5876 a Fj(15)p Black eop
+%%Page: 16 16
+16 15 bop Black 197 -132 a Fj(GNOME)20 b(Pr)o(ogramming)f(Guidelines)p
+Black 596 380 a Fl(Code)j(cleanups)h(ar)o(e)f(always)h(welcome;)g(if)g
+(you)h(\002nd)g(dirty)f(pieces)f(of)i(code)e(in)i(GNOME,)f(we)596
+471 y(will)i(gr)o(eatly)f(appr)o(eciate)f(it)i(if)f(you)i(submit)f
+(patches)f(to)i(make)e(the)h(code)g(pr)o(etty)f(and)g(easy)h(to)596
+562 y(maintain.)596 695 y(As)d(usual,)g(make)g(sur)o(e)f(your)i
+(contributed)f(code)g(compiles)h(without)g(warnings,)g(has)f(the)h(cor)
+o(-)596 786 y(r)o(ect)c(pr)o(ototypes,)i(and)f(does)h(things)h
+(following)g(the)f(guidelines)g(in)g(this)h(document.)197
+1132 y Fi(Documenting)35 b(Y)-12 b(our)33 b(Chang)q(es)596
+1283 y Fl(GNOME)23 b(uses)i(the)f(standar)o(d)e(GNU)i
+Fk(ChangeLog)f Fl(\002les)i(to)f(document)h(changes)f(to)g(the)g(code.)
+596 1375 y(Every)18 b(change)g(you)h(make)g(to)g(a)f(pr)o(ogram)g
+(should)h(be)g(accompanied)f(by)g(a)g(ChangeLog)h(entry)-9
+b(.)596 1466 y(This)21 b(lets)g(people)f(r)o(ead)f(the)i(history)h(of)f
+(changes)g(to)g(the)g(pr)o(ogram)f(in)h(an)g(easy)f(way)-9
+b(.)596 1599 y(If)18 b(you)h(use)g(Emacs,)f(you)h(can)g(add)f
+(ChangeLog)g(entries)h(by)g(pr)o(essing)g(\223C-x)e(4)i(a\224.)e(If)i
+(you)g(know)596 1690 y(the)h(pr)o(oper)f(incantation)h(for)g(other)g
+(popular)g(editors,)f(please)h(tell)g(us)g(so)g(that)g(we)g(can)g
+(expand)596 1781 y(this)h(document.)596 1914 y(ChangeLog)f(entries)h
+(have)g(the)f(following)j(general)d(format:)596 2079
+y Fk(1999-04-19)87 b(J.)45 b(Random)f(Hacker)88 b Fb(<)p
+Fk(jrandom foo org)p Fb(>)596 2244 y Fk(*)44 b(foo.c)g
+(\(some_function\):)e(Changed)i(the)g(way)h(MetaThingies)d(are)596
+2326 y(frobnicated.)87 b(We)45 b(now)f(use)g(a)h(hash)f(table)g
+(instead)g(of)g(a)h(linked)f(list)g(to)596 2408 y(look)g(MetaThingies)e
+(up.)596 2490 y(\(some_other_function\):)f(Support)i(the)i
+(MetaThingies)d(hash)j(table)f(by)596 2573 y(feeding)f(it)i(when)f
+(necessary)596 2737 y(*)g(bar.c)g(\(another_function\):)e(Fixed)i(bug)g
+(where)g(it)h(would)f(print)g("Take)596 2819 y(me)g(to)h(your)f
+(leader")f(instead)h(of)g("Hello,)g(World".)596 2984
+y(1999-04-18)87 b(Johnny)44 b(Grep)89 b Fb(<)p Fk(grep foobar com)p
+Fb(>)596 3148 y Fk(*)44 b(baz.c)g(\(ugly_function\):)e(Beautified)h(by)
+i(using)f(a)h(helper)e(function.)596 3364 y Fl(If)35
+b(you)h(add)f(a)g(new)h(function)g(to)g(a)g(library)-9
+b(,)34 b(please)h(write)h(the)g(necessary)f(r)o(efer)o(ence)e(and)596
+3455 y(pr)o(ogramming)d(documentation)i(for)f(it.)f(Y)-8
+b(ou)32 b(can)f(write)f(inline)i(r)o(efer)o(ence)c(documentation)596
+3546 y(by)19 b(using)g(the)h(comment)g(format)e(described)g(in)i
+Fk(gnome-libs/devel-docs/api-comment-)596 3638 y(style.txt)p
+Fl(.)28 b(If)i(you)g(use)h(Emacs,)e Fk
+(gnome-libs/tools/gnome-doc/gnome-doc.el)24 b Fl(pr)o(o-)596
+3729 y(vides)15 b(a)g(keyboar)o(d)g(shortcut)h(you)h(can)e(use)h(to)g
+(automatically)g(add)f(documentation)h(templates)596
+3820 y(to)21 b(your)g(code.)197 4166 y Fi(Changing)34
+b(Code)h(on)e(CVS)596 4317 y Fl(If)20 b(you)i(have)f(write)g(access)f
+(to)i(the)f(GNOME)g(CVS)g(r)o(epository)-9 b(,)20 b(ther)o(e)h(ar)o(e)f
+(additional)g(policies)596 4409 y(that)g(must)h(be)f(followed.)h(Since)
+f(you)h(ar)o(e)e(working)i(on)g(the)g(master)f(copy)h(of)f(the)g(sour)o
+(ces,)g(you)596 4500 y(have)g(to)h(be)f(especially)h(car)o(eful.)596
+4633 y(If)d(you)i(\002x)g(something)g(in)g(a)f(pr)o(ogram)g(that)g(is)g
+(on)h(CVS)f(or)g(if)g(you)h(add)e(functionality)i(to)g(it,)f(and)596
+4724 y(if)f(you)i(have)e(not)i(been)e(working)j(on)e(that)g(pr)o(ogram)
+f(for)h(a)f(long)i(time,)f(please)f(ask)h(the)g(original)596
+4815 y(author)j(befor)o(e)f(committing)i(your)g(patches.)e(Generally)h
+(it)h(is)f(OK)h(to)f(ask)g(these)h(questions)g(on)596
+4907 y(the)d Fk(gnome-devel-list)e Fl(mailing)k(list.)596
+5040 y(Once)j(the)h(author)g(of)f(the)h(pr)o(ogram)f(has)g
+(acknowledged)h(you)g(as)f(a)g(`fr)o(equent)g(contributor)6
+b(',)596 5131 y(you)27 b(may)g(begin)g(to)h(commit)g(your)f(patches)g
+(without)h(prior)f(consent.)h(If)e(you)i(want)f(to)g(do)g(a)596
+5222 y(major)21 b(r)o(e-or)o(ganization)e(of)i(the)f(code,)h(though,)g
+(you)h(should)f(ask)g(\002rst.)596 5355 y(Some)33 b(modules)g(on)h(CVS)
+f(have)g(stable)f(branches)h(and)g(development)g(branches.)g(Usually)
+596 5446 y(development)15 b(should)i(go)f(on)h(in)f(the)g(HEAD)f
+(branch)h(on)g(CVS,)f(and)g(the)h(stable)g(branch)f(should)p
+Black 197 5876 a Fj(16)p Black eop
+%%Page: 17 17
+17 16 bop Black 2495 -132 a Fj(GNOME)20 b(Pr)o(ogramming)f(Guidelines)p
+Black 596 380 a Fl(be)24 b(kept)h(separately)-9 b(.)23
+b(Generally)i(no)h(new)f(featur)o(es)f(ar)o(e)f(to)j(be)e(put)h(in)h
+(stable)f(branches;)f(only)596 471 y(bug)h(\002xes.)h(Make)e(the)i(bug)
+g(\002x)g(to)g(the)f(stable)h(branch)f(and)g(ask)h(the)g(main)g(author)
+f(about)h(the)596 562 y(policy)f(on)g(mer)o(ging)f(patches)h(to)f(the)h
+(development)g(branch;)f(some)h(authors)g(pr)o(efer)d(to)j(do)g(it)596
+654 y(in)c(batches,)f(while)h(others)h(pr)o(efer)c(to)k(mer)o(ge)e
+(them)h(immediately)-9 b(.)596 786 y(If)19 b(you)h(will)g(be)f(working)
+i(on)f(experimental)e(featur)o(es)g(that)i(could)f(br)o(eak)f(a)h(lot)h
+(of)g(code,)f(please)596 878 y(cr)o(eate)d(a)h(branch)h(on)h(CVS)e(and)
+h(do)g(your)h(changes)f(ther)o(e.)f(Do)i(not)f(mer)o(ge)g(them)g(onto)h
+(the)g(main)596 969 y(development)g(branch)h(until)g(you)g(ar)o(e)e(r)o
+(easonably)h(con\002dent)i(that)e(they)h(work)g(corr)o(ectly)f(and)596
+1060 y(ar)o(e)e(nicely)j(integrated)f(with)h(the)f(r)o(est)g(of)g(the)g
+(code.)g(Using)h(a)e(branch)h(to)h(work)g(on)g(experimen-)596
+1152 y(tal)28 b(featur)o(es)f(lets)h(you)h(avoid)f(disr)o(upting)i(the)
+e(work)h(of)g(other)g(developers.)e(Please)h(ask)h(the)596
+1243 y(main)21 b(author)f(befor)o(e)g(mer)o(ging)h(your)g(branch)f
+(back)h(into)g(the)g(main)g(part)f(of)h(the)g(tr)o(ee.)596
+1376 y(As)h(usual,)g(add)g(a)g(ChangeLog)h(entry)g(when)g(you)h(make)e
+(a)g(change.)h(Some)g(authors)g(have)f(the)596 1467 y(policy)f(of)g(r)o
+(ejecting)f(changes)h(that)g(do)g(not)g(have)f(such)h(an)g(entry)-9
+b(,)20 b(and)h(rightly)g(so.)596 1600 y(Sometimes)28
+b(dif)o(fer)o(ent)e(commiting)j(policies)f(exist)g(for)g(the)g
+(modules,)g(check)g(if)g(the)g(module)596 1691 y(contains)21
+b(a)f Fk(README.CVS)f Fl(\002le,)i(and)f(if)h(so,)g(please)f(check)h
+(that)f(\002le)h(befor)o(e)f(making)h(changes.)197 2037
+y Fi(Branc)o(hes)35 b(and)f(CVS)596 2188 y Fl(The)26
+b(new)g(policies)g(for)g(branches)g(in)g(CVS)g(ar)o(e)e(to)j(use)f
+(FOO-branchpoint)h(for)f(the)g(a)f(branch)596 2280 y(point)f(tag,)g
+(and)f(FOO-branch)h(for)g(the)g(branch)g(itself.)g(Although)h(this)g
+(is)f(in)g(not)h(used)f(every-)596 2371 y(wer)o(e)19
+b(curr)o(ently)i(this)g(is)g(the)g(new)g(policy)h(we)e(ar)o(e)g(using.)
+197 2844 y Fn(Maintaining)37 b(a)j(P)l(ac)m(ka)o(g)q(e)596
+3008 y Fl(A)33 b(package)f(maintainer)h(is)h(a)f(person)h(who)g(takes)f
+(car)o(e)f(of)i(making)g(r)o(eleases,)d(integrating)596
+3099 y(changes)f(fr)o(om)f(other)h(people,)g(and)g(in)g(general)g
+(being)g(r)o(esponsible)g(for)g(the)g(well-being)g(of)596
+3190 y(a)19 b(package.)f(During)j(the)f(lifetime)g(of)g(a)f(package,)g
+(it)h(may)g(change)g(maintainers,)f(for)h(example,)596
+3282 y(if)d(a)h(person)g(loses)h(inter)o(est)e(or)i(can)e(no)i(longer)f
+(dedicate)f(enough)i(time)f(to)h(being)f(a)f(maintainer)-6
+b(.)596 3414 y(In)26 b(conformance)g(with)i(the)e(GNU)g(Coding)h
+(Standar)o(ds,)d(GNOME)i(uses)h(GNU)f(Autoconf)h(to)596
+3506 y(handle)21 b(portability)h(issues)h(and)e(GNU)h(Automake)g(to)g
+(cr)o(eate)e(make\002les.)i(Automake)g(makes)596 3597
+y(it)j(especially)f(easy)h(to)h(build)f(corr)o(ect)f(packages,)g(so)h
+(if)g(you)h(ar)o(e)d(a)i(package)f(maintainer)-6 b(,)24
+b(you)596 3688 y(should)k(learn)g(how)h(to)f(use)g(it.)g(Autoconf)h
+(and)e(Automake)h(have)g(a)f(lot)i(of)f(tricky)g(issues,)g(so)596
+3780 y(please)21 b(feel)g(fr)o(ee)f(to)j(ask)e(for)h(help)g(in)g(the)g
+(GNOME)g(development)g(mailing)h(lists)f(if)g(you)g(have)596
+3871 y(questions)g(about)e(how)i(to)f(build)g(corr)o(ect)f(make\002les)
+h(for)f(your)h(package.)596 4004 y(A)g(number)h(of)f(people)h(r)o
+(egularly)f(contribute)h(with)g(localized)f(translations)i(for)e(the)h
+(message)596 4095 y(catalog)f(\002les)g(in)h(GNOME)g(packages.)e(In)i
+(or)o(der)e(to)i(keep)f(translations)h(as)f(up)g(to)h(date)f(as)g(pos-)
+596 4186 y(sible,)i(package)f(maintainers)h(should)h(coor)o(dinate)f
+(with)h(translators)f(so)h(that)f(the)h(latter)e(ones)596
+4278 y(can)e(update)f(the)i(translations)g(in)g(time)f(for)h(a)f(r)o
+(elease)e(of)j(the)f(package.)g(It)g(is)h(consider)o(ed)e(good)596
+4369 y(form)g(to)h(notify)g(translators)g(some)g(days)f(in)h(advance)f
+(befor)o(e)f(making)i(a)f(r)o(elease;)f(please)h(send)596
+4460 y(a)27 b(noti\002cation)i(message)f(to)g(<)p Fk
+(gnome-i18n nuclecu unam mx)p Fl(>.)c(This)29 b(will)f(let)g(them)g
+(up-)596 4552 y(date)19 b(their)i(r)o(espective)f(translations)h(on)g
+(time)g(so)h(that)e(they)i(will)f(be)f(included)h(in)g(the)g(r)o
+(elease.)197 4942 y Fn(Wh)m(y)40 b(Y)-14 b(ou)38 b(Should)g(W)-9
+b(orr)q(y)41 b(About)d(Memor)q(y)g(Leaks.)596 5105 y
+Fl(T)-8 b(ake)33 b(a)h(look)h(at)e(the)h(Mozilla)g(bug)g(lists)h(and)e
+(one)i(thing)g(is)f(clear:)f(new)h(code)g(that)g(enters)596
+5196 y(Mozilla)c(is)h(not)g(\(or)g(has)g(not)g(been\))f(suf)o
+(\002ciently)h(checked)g(for)f(memory)i(leaks)e(and)h(access)596
+5287 y(tr)o(ouble.)596 5420 y(Memory)20 b(leaks)h(ar)o(e)e(bad)h(for)g
+(several)g(r)o(easons:)p Black 3601 5876 a Fj(17)p Black
+eop
+%%Page: 18 18
+18 17 bop Black 197 -132 a Fj(GNOME)20 b(Pr)o(ogramming)f(Guidelines)p
+Black Black 596 380 a Fh(\225)p Black 69 w Fl(They'll)28
+b(eat)e(your)h(swap)f(space)h(slowly)-9 b(.)27 b(Eventually)g(your)g
+(pr)o(ogram)f(or)h(even)f(your)h(ma-)679 471 y(chine)21
+b(will)g(be)g(br)o(ought)g(to)g(its)g(knees.)679 604
+y(Y)-8 b(ou)29 b(don't)g(want)f(to)h(give)f(your)h(pr)o(ogram)e(or)i
+(library)e(a)h(bloat-war)o(e)f(r)o(eputation)h(just)h(be-)679
+695 y(cause)20 b(you)h(wer)o(e)f(lazy)-9 b(.)19 b(Leave)h(that)h(to)g
+(people)f(in)i(Redmont.)p Black 596 869 a Fh(\225)p Black
+74 w Fl(They)32 b(hide)f(bad)g(use)h(of)f(memory)-9 b(.)32
+b(If)f(you)h(for)o(get)f(to)h(fr)o(ee)e(memory)-9 b(,)32
+b(ther)o(e)f(r)o(eally)f(is)i(no)679 961 y(way)23 b(to)g(catch)g(r)o
+(eads)e(and)i(writes)g(to)h(that)f(chunk)h(of)f(memory)-9
+b(.)23 b(If)g(you)g(later)g(\002x)g(the)g(leak,)f(a)679
+1052 y(completely)f(dif)o(fer)o(ent)d(part)i(of)h(the)g(pr)o(ogram)f
+(could)h(go)g(*poof*.)p Black 596 1185 a Fh(\225)p Black
+73 w Fl(When)31 b(using)h(automatic)f(memory)g(checkers,)f(you)h(don't)
+h(want)f(to)g(see)f(600)f(pr)o(oblems,)679 1276 y(500)g(of)i(which)h
+(in)f(support)h(libraries.)e(Y)-8 b(ou)32 b(r)o(eally)e(want)h(to)h
+(know)g(that)f(things)h(wer)o(e)e(by)679 1368 y(and)20
+b(lar)o(ge)f(clean)h(befor)o(e)f(you)i(started)f(messing,)h(and)f(ther)
+o(efor)o(e)f(that)h(all)g(the)h(pr)o(oblems)f(ar)o(e)679
+1459 y(yours)h(to)g(\002x.)679 1592 y(This)e(is)h(one)g(of)f(Mozilla's)
+g(pr)o(oblems)g(right)h(now:)g(it)f(leaks)g(like)h(crazy)e(so)i(how)g
+(ar)o(e)e(you)i(ever)679 1683 y(going)h(to)h(know)f(if)g(you)g(just)h
+(added)d(to)i(the)g(pr)o(oblem?)197 2070 y Fi(Some)34
+b(Ad)n(vice)h(in)f(the)f(Fight)h(Against)g(Memor)q(y)g(Leaks.)p
+Black 596 2401 a Fh(\225)p Black 63 w Fl(Use)21 b("const")g(whenever)f
+(you)i(can)e(\(for)g(pointers)i(that)e(is\).)679 2534
+y(If)e(an)g(ar)o(gument)g(is)h("const",)f(then)h(undoubtedly)g(the)g
+(function)g(you)g(call)f(will)h(not)h(fr)o(ee)c(it)j(for)679
+2625 y(you.)679 2758 y(If)h(a)g(function)h(r)o(esult)f(type)g(is)h
+("const",)f(then)h(clearly)f(you)h(ar)o(e)e(not)i(r)o(esposible)f(for)g
+(fr)o(eeing)g(it.)679 2849 y(Y)-8 b(ou)20 b(*pr)o(obably*)g(ar)o(e)e
+(for)i(a)f(non-"const")i(r)o(esult)e(\(that)g(isn't)i(just)g(an)e
+(integer)h(or)g(some)g(such\).)679 2982 y(Note,)k(that)g(unfortunately)
+g(this)h(does)f(not)h(work)g(very)e(well)i(with)g(r)o(ef-counted)d
+(objects.)j(It)679 3073 y(works)c(gr)o(eat)f(with)h(strings.)679
+3206 y(Since)16 b(C)g(uses)h(call-by-value,)e(ther)o(e)h(is)h(no)h
+(point)f(in)g(making)h(ints,)f(doubles,)f(and)h(such)g(types)679
+3297 y("const".)p Black 596 3472 a Fh(\225)p Black 63
+w Fj(Document)j(r)o(esposibilities.)p Black 679 3646
+a Fa(\225)p Black 67 w Fl(If)h(a)f(function)h(takes)g(ownership)h(of)e
+(an)h(object/r)o(ef,)f(be)g(explicit)h(about)g(it.)p
+Black 679 3779 a Fa(\225)p Black 67 w Fl(Always)g(say)g(if)f(the)h
+(caller)f(should)i(fr)o(ee/unr)o(ef)c(r)o(esults.)p Black
+679 3912 a Fa(\225)p Black 67 w Fl(Document)k(*how*)g(to)f(get)g(rid)g
+(of)f(memory:)i(unr)o(ef,)d(fr)o(ee,)g(g_fr)o(ee,)g(...)p
+Black 596 4086 a Fh(\225)p Black 63 w Fj(Be)i(car)o(eful)g(when)g
+(using)g(cut-and-paste.)679 4219 y Fl(The)e(pr)o(ocess)h(of)g(cutting)g
+(and)g(pasting)g(does)g(not)h(impr)o(ove)e(code,)h(contrary)f(to)i(the)
+f(belief)f(of)679 4310 y(many)24 b(pr)o(ogrammers.)f(Please)h(look)h
+(the)g(code)f(over)g(\002rst,)g(and)g(if)g(you)h(intend)f(to)h(pr)o
+(oduce)679 4402 y(many)c(copies,)f(then)i(per)o(haps)d(you)i(need)g(a)f
+(helper)h(function.)p Black 596 4576 a Fh(\225)p Black
+63 w Fj(Fr)o(ee)h(everything)d(at)h(exit.)679 4709 y
+Fl(This)h(takes)f(time,)h(so)g(per)o(haps)f(you)h(should)h(only)g(do)e
+(this)i(within)g(a)e(conditional.)679 4842 y(The)j(r)o(eason)f(for)h
+(this)h(piece)e(of)h(advice)f(is)i(that)f(memory)g(leak)g(checkers)g
+(have)f(a)h(har)o(d)f(time)679 4933 y(distinguishing)g(between)f(leaks)
+g(you)g(know)h(and)e(don't)h(car)o(e)e(about)i(and)f(other)h(leaks.)p
+Black 596 5107 a Fh(\225)p Black 63 w Fj(Don')m(t)f(leave)h(dangling)f
+(pointers)h(in)g(your)f(data)g(structur)o(es.)679 5240
+y Fl(Assign)g(NULL)e(or)i(\(void)f(*\)0xdeadbeef)e(to)j(fr)o(eed)e
+(members)h(unless)i(you)f(ar)o(e)e(going)j(to)e(fr)o(ee)679
+5331 y(the)h(str)o(uctur)o(e)h(they)g(ar)o(e)e(in)i(right)h(away)-9
+b(.)679 5464 y(Dangling)21 b(pointers)h(have)e(a)g(bad)g(tendency)h(of)
+g(shielding)g(leaks.)p Black 197 5876 a Fj(18)p Black
+eop
+%%Page: 19 19
+19 18 bop Black 2495 -132 a Fj(GNOME)20 b(Pr)o(ogramming)f(Guidelines)p
+Black Black 596 380 a Fh(\225)p Black 63 w Fj(Run)j(your)e(new)h(code)g
+(a)f(million)h(times)g(in)g(a)f(loop.)679 512 y Fl(If)g(it)h(leaks,)f
+(you'll)i(know)g(\226)e(just)h(follow)h(the)f(pr)o(ocess)f(with)i(top)f
+(in)g(another)g(window)-8 b(.)p Black 596 687 a Fh(\225)p
+Black 63 w Fj(Fix)21 b(it)f(now)-5 b(,)21 b(not)g(later)-6
+b(.)679 820 y Fl(Do)21 b(not)g(write)g(sloppy)h(code;)e(it)h(will)g
+(get)g(back)f(to)h(you)h(later)-6 b(.)p Black 3601 5876
+a Fj(19)p Black eop
+%%Page: 20 20
+20 19 bop Black Black Black Black eop
+%%Trailer
+end
+userdict /end-hook known{end-hook}if
+%%EOF


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]