AS 3955—1991 ISO/IEC ISO/IEC 9899: 1990
. m o c . l a b o l g i a s . e r o t s o f n i / / : p t t h t a n o i s r e v l l u f e h t s s e c c A . e l p m a s e g a p 9 e e r f a s i s i h T
Australian Standard® Programming languages—C
This Australian Australian Standard Standard was prepared prepared by Committee Committee IT/9, Informati Information on Systems— Systems— Vocabul Vocabulary ary and Software. Software. It was approve approved d on behalf behalf of the Council Council of Standards Standards Australia on 9 May 1991 and published on 12 July 1991.
The following interests are represented on Committee IT/9: . m o c . l a b o l g i a s . e r o t s o f n i / / : p t t h t a n o i s r e v l l u f e h t s s e c c A . e l p m a s e g a p 9 e e r f a s i s i h T
Attorney-Generals Department AUSTEL Australian Bankers’ Association Australian Bureau of Statistics Australian Chamber of Manufacturers Australian Computer Society Australian Computer Users Association Department of Defence Department of Finance Landata Telecom Australia Universities and Colleges
Review of Austr alia n Standa rds. To keep abreast of progress in industry, Australian Standards are subject to periodic periodic review review and are kept up t o date date by the issue of amendments amendments or new editions editions as necess necessar ary. y. It is important therefore therefore that Standards users ensure that t hey are in possess possession ion of the latest edition, and any amendments amendments thereto. thereto. Full details of all Australian Australian Standards Standards and related publications will be found in t he Standards Standards A ustralia ustralia Catalogue of Publications; this information information is supplemented supplemented each month by t he magazine magazine ‘The Australian Australian Standard’, Standard’, which subscribing subscribing members members receive, a nd w hich gives details details of new publications, new editions and amendments, amendments, and of withdrawn Standards. Standards. Suggestions Suggestions for improvements improvements t o Australian Australian Standards, Standards, address addressed ed to t he head offi ce of Standards Standards Australia, are welcomed. Notification of any inaccuracy or ambiguity found in an Australian Standard should be made without delay in order that the matter may be investigated and appropriate appropriate action taken.
AS 3955—1991
. m o c . l a b o l g i a s . e r o t s o f n i / / : p t t h t a n o i s r e v l l u f e h t s s e c c A . e l p m a s e g a p 9 e e r f a s i s i h T
Australian Standard® Programming languages—C
First published as AS 3955—1991.
PUBLISHED BY STANDARDS STANDARDS AUSTRALIA (STANDARDS ASSOCIATION OF AUSTRALIA) 1 THE CRESCENT, HOMEBUSH, NSW 2140 ISBN 0 7262 6970 0
2 PREFACE This S tanda tandard rd was prepa prepared red by the Standa Standards rds Austra Australia lia Comm Committee ittee on Inform Informati ation on System Systems— s— Vocabular Vocabulary y and S oftware. oftware. It is identical identical with and has been reproduced reproduced from ISO/IEC 9899:1990 9899:1990 Programming languages— C. Under Under arrange arrangement mentss made between between Standards Standards Australia Australia and the internation international al Standards Standards bodies bodies,, ISO and IEC, as well as certain certain other Standards organizations, organizations, users of this Australian Standard are advised of the following: (a) Copyright Copyright is vested vested in Standards Standards Australia. Australia. (b) The number number of this Standard Standard is not reprodu reproduced ced on each each page; its identity identity is shown only only on the cover cover and title pages. pages. For the purposes of this Australian Standard, the ISO/IEC text should be modified as follows: . m o c . l a b o l g i a s . e r o t s o f n i / / : p t t h t a n o i s r e v l l u f e h t s s e c c A . e l p m a s e g a p 9 e e r f a s i s i h T
(i)
Terminology The words ‘Australian Standard’ should replace the words ‘International Standard’ wherever wherever they appear.
(ii) References The referen references ces to Interna Internation tional al Standar Standards ds shoul should d be replac replaced ed by referen reference cess to Australian Standards as follows: Reference to International Standard
Australian Standard
ISO 646 646
AS 1776 1776 Informa Informatio tion n process processing ing—7—7-bit bit coded coded charcharacter set for information interchange
Info Inform rmat atio ion n proc proces essi sing ng—I —ISO SO 7-bi 7-bitt code coded d character character set for information information interchange interchange
4217 4217 Codes Codes for the repres represent entati ation on of curren currencie ciess and funds
Copyright © Copyright
—
STANDARDS STANDARDS AUSTRAL AUSTRALIA IA
Users Users of Standards Standards are reminded reminded that copyright copyright subsi subsists sts in all Standards Standards Australia Australia publications publications and software. software. Except Except where where the Copyright Copyright Act allows and except except where where provided provided for below below no publication publicationss or software produced produced by Standards Standards Australia Australia may be reprod reproduc uced ed,, store stored d in a retrieva retrievall syst system em in any any form or transmit transmitted ted by any any means means withou withoutt prior prior permi permiss ssion ion in writing writing from Standards Standards Australia. Permission Permission may be conditional on an appropriate royalty payment payment.. Requests Requests f or permission permission and inform ation on commercial software royalties should be directed to the head office of Standards Australia. Standa Standards rds Australia Australia will permit up to 10 percent percent of the technic technical al content pages of a Standa Standard rd to be copied copied for use exclusively exclusively in-house by purchasers purchasers of the Standard without payment of a royalty or advice t o Standards Standards Australia. Standards Australia will also permit the inclusion of its copyright material in computer software programs for no royalty payment payment provided such programs are used exclusively exclusively in-house by the creators of the programs. Care Care should should be taken taken to ensure ensure that material material used used is from the current current edition edition of t he Standard Standard and that it i s updated updated whenever whenever the Standard Standard is amended amended or revised. The number number and date date of the Standard should t herefore be clearly clearly i dentified. The use of material material in print form or in computer computer software software programs programs to be used commercia commercially, lly, with or without without payment, payment, or in commercial contracts is subject to the payment of a royalty. This policy may be varied by Standards Australia at any time.
3
CONTENTS Page
. m o c . l a b o l g i a s . e r o t s o f n i / / : p t t h t a n o i s r e v l l u f e h t s s e c c A . e l p m a s e g a p 9 e e r f a s i s i h T
1
Sc op ope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7
2
Nor ma mat iv iv e re re fe fe re rences . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7
3
De fi fin it iti on ons an and co co nv nve nt nt io io ns ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
8
4
Co m pl i an ance
9
5
En vi vir on onment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5.1 Co nc nce pt ptu al al m od odel s . . . . . . . . . . . . . . . . . . . . 5.1 .1 .1 Tr an ansl at at io io n en env ir ir on onm en ent . . . . . . . . . . . 5.1 .2 .2 Ex ec ecu ti tio n en envir on onme nt nt s . . . . . . . . . . . 5.2 Envi nvironme ronment ntaal con conside siderration ationss . . . . . . . . . . . . . 5.2 .1 .1 Ch ar ara ct cte r se se ts ts . . . . . . . . . . . . . . . . . . 5.2 .2 .2 Ch ar ara ct cte r di di sp sp la lay s em em an ant ic ics . . . . . . . . 5.2 .3 .3 Si gn gnal s a nd nd i nt nt er err up upt s . . . . . . . . . . . . . 5.2 .4 .4 En vi vir on onm en ent al al l i mi mi ts ts . . . . . . . . . . . . .
. .. . . . .. . .. . . . .. .. . . .. .. . ... . . . ... . . . .. . . . . ... . . . ... . .
11 11 11 12 16 16 18 18 18
6
La ng nguage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1 Le xi xic al al el el em em en ent s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1.1 Keywor ds ds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1 .2 .2 Id en ent if ifi er er s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1.3 Const an ant s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1.4 St ri rin g li te ter al als . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1.5 Opera to tor s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1 .6 .6 Pu nc nct ua uat or or s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1.7 Header n am am es es . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1 .8 .8 Pr ep epr oc oce ss ss in ing n um um be ber s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.1.9 Com me ments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2 Co nv nver si si on ons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2 .1 .1 Ar iitth me met ic ic o pe pera nd nds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.2 .2 .2 Ot he her o pe pera nd nds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 Ex pr pre ss ssi on ons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 .1 .1 Pr i ma ma ry ry e xp xpr es es si sio ns ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 .2 .2 Po st stf i x o pe per at at or or s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 .3 .3 Un ar ary o pe per at ato rs rs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 .4 .4 Ca st st op oper at at or ors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 .5 .5 Mul ti ti pl pli ca ca ti tiv e op ope ra ra to to rs rs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 .6 .6 Ad di dit i ve ve o pe per at at or ors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 .7 .7 Bi t wi wi se se sh if if t op oper at at or ors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 .8 .8 Re la lat io ional o pe per at at or ors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 .9 .9 Eq ua ual it ity o pe pera to tor s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 .1 .10 Bi t wi wi se se AN AN D op ope ra ra to to r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3. .3.11 Bitwise itwise exclu xclussive OR OR ope operat rator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3. .3.12 Bitwise itwise inclu nclussive ive OR op operat rator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 .1 .13 Lo gi gic al al AN AN D op opera to tor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 .1 .14 Lo gi gic al al OR OR o pe per at ato r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3. .3.15 Cond ondition itional al ope operato ratorr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3. .3.16 Assi ssignm gnment ent oper operaators tors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.3 .1 .17 Co mm mma o pe per at ato r . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.4 Co ns nst an ant e xp xpr es es si sio ns ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5 De cl cla ra rat io io ns ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5. .5.1 Storag toragee-cla -classs spe specif cifiers iers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5 .2 .2 Ty pe pe sp spec if if i er er s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5 .3 .3 Ty pe pe qu qual if if i er er s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5 .4 .4 De cl cla ra rat or or s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
24 24 25 25 31 36 37 38 38 39 39 40 40 42 44 45 45 49 51 52 52 54 54 55 56 56 56 57 57 57 59 60 61 63 64 64 70 71
. . .. . . . .. . . .. . . . . . . .. . . . .. .. . .. . .. . .. .. . .. . . . . .. . . . . . . . . . . . . .
.. .. .. . . . ... . ... .. . . . . .. .. . . .. . . .. . .
. . .. . . . . .. . . .. .. ..
... .. . ... ... . .. ... . .. . .. . ..
. . . . . . . . .
. .. . . . .. .. . . . .. . .. . .. . .. . .. .. . . .. .. . .. . . .. . .. .. . . .. .. .
4 Page
6.5.5 Ty pe pe na n am e s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5 .6 .6 Ty pe pe de def iin ni ti tio ns ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.5 .7 .7 In it iti al ali za zat io io n . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . St at ate me ments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6 .1 .1 La be bel ed ed st sta te tem en ent s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6 .2 .2 Co mp mpou nd nd st at ate me me nt nt, o r b lo lo ck ck . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6. .6.3 Expre xpress ssio ion n and and nu null sta stattemen ementts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6 .4 .4 Se l ec ec ti tio n s ta ta te te me ment s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6 .5 .5 It er era ti tio n s ta ta te tem en ent s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.6 .6 .6 Jum p s ta tat em eme nt nt s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Ex te ter na nal d ef ef iin n it iti on ons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.7 .1 .1 Fu nc nct io ion d ef efi ni ni ti tio ns ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.7 .2 .2 Ex te ter na nal o bj bj ec ec t de de fi fi ni ni ti tio ns ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Pr ep epr oc ocess in ing d ir ir ec ect iv i ve s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.8 .1 .1 Co nd ndi ti tio na nal i n cl cl us usi on on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.8 .2 .2 So ur urc e fi fi l e in cl cl us usi on on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.8 .3 .3 Mac ro ro r ep ep la la ce cement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.8.4 Li ne ne co contr ol ol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.8 .5 .5 Er r or or d ir ir ec ecti ve ve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.8 .6 .6 Pr ag agma di di rree ct cti ve ve . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.8 .7 .7 Nu ll ll di di rree ct ct iv ive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.8. .8.8 Predef redefiined ned macro macro na names mes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Future uture la langu nguage dire direct ctio ions ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.9 .1 .1 Ex te ter na nal n am am es es . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.9. .9.2 Chara haract cter er eesc scap apee sequ sequeence nces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.9. .9.3 Storag toragee-cla -classs speci speciffiers iers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.9. .9.4 Func unction tion dec declara larattors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.9. .9.5 Func unction tion def definiti inition onss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6.9 .6 .6 Ar ra ray p ar ar am amet er er s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
75 76 77 81 81 81 82 83 84 85 87 87 89 91 92 93 95 99 99 99 100 100 101 101 101 101 101 101 101
Li br bra ry ry . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1 In tr tro du ducti on on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1 .1 .1 De fi fin it iti on ons o f te te rm rm s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1 .2 .2 St a nd nda rd rd h ea eader s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1. .1.3 Rese eserve rved ident identif ifie iers rs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1. .1.4 Errors rrors
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1. .1.5 Limits imits and . . . . . . . . . . . . . . . . . . . . . . . 7.1. 7.1.6 6 Commo Common n defini definition tionss . . . . . . . . . . . . . . . . . . . . . . . . . . 7.1 .7 .7 Us e o f li lib ra ra ry ry fu fu nc nct io io ns ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2 7.2 Diagn Diagnos ostics tics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.2. .2.1 Progra rogram m dia diag gnos nostics tics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3 7.3 Char Charact acter er handli handling ng . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3. .3.1 Chara haract cter er tes testing ting fun functi ctions ons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.3. .3.2 Chara haract cter er ccas asee mapp mappiing fun funcctions tions . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.4 7.4 Loca Localiz lizat ation ion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.4 .1 .1 Lo ca cal e co co nt nt rro ol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.4. .4.2 Nume umeric fo format rmattting conv conveention ntion inqu inquiry iry . . . . . . . . . . . . . . . . . . . . . . . 7.5 7.5 Mathe Mathema matics tics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5. .5.1 Treatm reatmeent of of erro errorr cond conditi ition onss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5. .5.2 Trigo rigonome nometri tricc func unction tions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5 .3 .3 Hy pe per bo bol ic ic f un unct io io ns ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5. 7.5.4 4 Expo Expone nent ntia iall and and loga logari rithm thmic ic func functio tions ns . . . . . . . . . . . . . . . . . . . . . . . . 7.5 .5 .5 Po we wer f un un ct ct io ions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.5. 7.5.6 6 Near Nearest est int intege eger, r, abso absolut lutee valu value, e, and and rema remain inde derr funct function ionss . . . . . . . . . . . 7.6 7.6 Nonl Nonloca ocall jump jumpss jmp.h> . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.6. .6.1 Save ave cal callling enviro nvironm nmeent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.6. .6.2 Rest estore callin alling g env environ ironm ment ent . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.7 7.7 Signal Signal handl handling ing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
102 102 102 102 103 103 104 104 105 107 107 108 108 110 112 113 114 117 117 117 119 120 120 121 122 122 124 124 125 126
6. 6
6. 7 . m o c . l a b o l g i a s . e r o t s o f n i / / : p t t h t a n o i s r e v l l u f e h t s s e c c A . e l p m a s e g a p 9 e e r f a s i s i h T
6. 8
6.9
7
5 Page
7.7 .1 .1 Sp ec eci ffy y si si gn gnal h an andli ng ng . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.7 .2 .2 Se nd nd si sig na nal . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Variab Variable le argum argument entss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.8. .8.1 Vari ariabl able argu argumen ment list acce ccess macr macros os . . . . . . . . . . . . . . . . . . . . . . . . . Inpu Input/ou t/outpu tputt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.9 .1 .1 In tr tro du ducti on on . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.9.2 St re r ea m s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.9 .3 .3 Fi l es es . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.9 .4 .4 Op er era ti tio ns ns o n fi fi le le s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.9 .5 .5 Fi l e acc es es s fu fu nc nct io io ns ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.9. .9.6 Format ormattted in input/ou ut/outp tpu ut fun functi ctions ons . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.9. .9.7 Chara haract cter er inp input/ou t/outp tpu ut func functtions ions . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.9. .9.8 Direct irect inp inpu ut/out t/outpu putt func functions tions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.9. .9.9 File positi sition oniing fun functi ctions ons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.9. .9.10 Error-h rror-han and dling ling func functi tion onss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . General General utilities utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.10 .10.1 String tring con conv vers ersion ion func unction tionss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.10 7.10.2 .2 Pseu Pseudo do-ra -rand ndom om seque sequenc ncee gene genera rati tion on funct function ionss . . . . . . . . . . . . . . . . . . 7.10 7.10.3 .3 Memor emory y manag managem emen entt func functio tions ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.10 7.10.4 .4 Comm Commun unic icat atio ion n with with the env enviro ironm nmen entt . . . . . . . . . . . . . . . . . . . . . . . . 7.10 .10.5 Searc earchi hing ng and and sorti sorting ng util utilit ities ies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.10 .10.6 Intege ntegerr arith arithme metic tic fun funcction tions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.10 .10.7 Mult ultibyte ibyte cha chara raccter ter fun function ctionss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.10 .10.8 Mult ultibyte ibyte stri string ng fun funcction tionss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . String handling handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.11 .11.1 String tring fun funcction tion conv conventi ention onss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.11 .11.2 Copy opying ing func functi tion onss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.11 .11.3 Conc oncate atenatio nation n func unction tionss . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.11 .11.4 Comp ompari arison son funct functiions ons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.11 .11.5 Searc earch h fun functi ctions ons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.11 .11.6 Misc iscell ellaneo aneou us funct unctiions ons . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Date Date and and time time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.12 .12.1 Comp omponent nentss of time ime . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.12 .12.2 Time man manipu ipulatio lation n fun functio ction ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.12 .12.3 Time con convers versiion funct functio ions ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Future uture libra library ry di directio rection ns . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.13 7.13.1 .1 Errors Errors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.13.2 7.13.2 Character Character handling handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.13.3 7.13.3 Localization Localization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.13.4 7.13.4 Mathema Mathematics tics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.13.5 7.13.5 Signal Signal handl handling ing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.13.6 7.13.6 Input/out Input/output put . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.13.7 7.13.7 General General utilities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7.13.8 7.13.8 String handling handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
126 127 128 128 130 130 131 132 133 134 137 147 150 151 153 155 155 159 159 160 160 161 161 163 164 165 167 168 168 168 169 170 171 174 176 176 176 178 182 182 182 182 182 182 182 182 182
A
Bi bl bli og ogr ap aph y . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
183
B
La ng ngua ge ge s y nt nt ax ax s um um ma ma ry ry . . . B. 1 Le xi xic al al gr gr am am ma mar . . . . . . B.2 Phrase hrase str struc uctu turre gram gramm mar B.3 Prepro reproccessin essing g direc directiv tives es .
. . . .
184 184 188 193
C
Se qu quen ce ce p oi oi nt nt s . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
195
D
Li br bra ry ry su summ ar ary . . . . . . . . . . . . . . . . . . D.1 Errors rrors . . . . . . . . . . . D.2 D.2 Commo Common n defini definition tionss D.3 D.3 Diagn Diagnos ostics tics . . . . . . .
196 196 196 196
7.8 7.8 7.9 7.9
. m o c . l a b o l g i a s . e r o t s o f n i / / : p t t h t a n o i s r e v l l u f e h t s s e c c A . e l p m a s e g a p 9 e e r f a s i s i h T
7.10 7.10
7.11 7.11
7.12 7.12
7.13 .13
Annexes
. . . .
. . . .
. . . .
. . . .
.. . . . . . . . . .. . . . . .. . . . .. .
. . . .
. . . .
. . . .
.. . . . . . .. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. .. . .. .. . .. .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . .. . . . . . . .. .. . .
. . . .
. . . .
. . . . .. . . . . . .
. . . .
. . . .
. . . .
.. . . .. ..
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
. . . .
.. . . .. . .. .. .
. . . .
. . . .
.. . . . . . . . . . .
6 Page
D.4 D.4 D.5 D.5 D.6 D.6 D.7 D.7 D.8 D.8 D.9 D.9 D.10 D.11 D.12 D.13
. m o c . l a b o l g i a s . e r o t s o f n i / / : p t t h t a n o i s r e v l l u f e h t s s e c c A . e l p m a s e g a p 9 e e r f a s i s i h T
Char Charact acter er han handli dling ng . Localiz Localizat ation ion . . . . . Mathe Mathema matics tics . . . . . . . jmp.h> . . Nonl Nonloca ocall jum jumps ps Signal Signal handl handling ing . . . Variab Variable le argum argument entss I nput/output nput/output . . . . . . General General utilities . . String handling handling . . . Date and and time . . . . . .
. . . . . . . . . .
.. . . . . . . .. . . .. . . .. ..
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . .. .. . . . . . . . . . . .. . . . .. . . . . . . . . . . .. .
. . . . . . . . . .
. .. . . . .. .. . . .. . . . . . . . . .. . .. . .. . . . . . . . .. .
. . . . . . . . . .
. . . . . . . . . .
. . . . . . . .. . .. .. . . . . . . . . .. .. . . . .
196 196 197 197 197 198 198 200 201 201
E
Im pl ple me menta ti tio n li li mi mi ts ts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
202
F
Co mm mmon w ar ar ni nin gs gs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
204
G
Po rt rta bi bil it it y is iss ue ues . . . . . . . . . . . . . . . . . . . . G.1 Unsp nspeci ecified fied beh behavi avior . . . . . . . . . . . . . G.2 Unde ndefine fined behav behaviior . . . . . . . . . . . . . . G.3 Impl mpleme ementati ntation on-d -deefined fined beha behavio vior . . . . G.4 Loca ocalele-spec speciific beh behav avio iorr . . . . . . . . . . G. 5 Co mm mmon e xt xt en ens io ions . . . . . . . . . . . . .
.. . . . . . .. . . . . . . .. . . . . . . . . . . . .. . . . .. . . .. . . . . . . . . . . . . . .. . . . . .. . . . .. . . . .. . . . .. . . .
205 205 206 210 213 214
In de dex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
216
.. . . . .. . . . . .. . . . . .. . . . . . . . . . . . .. . . . .. . . . . . .. . . . . . . . . . . . .. . . . . . . . .. . . . .. . . . . . .. . . . .. . . . . . ..
. . . . . . . . . .
. . . . . .
. . . . . . .. .. . . . . . . . . . . .. . . . .. . . . . . . . . . . .. .
. . .. . . . . . . . . .. . . .. . . .. . . . . . . .. . . . .. . .. . . .. . . . . . . ..
. . . . . . . . . .
A US TR AL I A N ST A N DA R D
7 STANDARDS STANDARDS AUSTRALIA AUSTRALIA
Australian St andard andard Programming languages—C
1 Sc Scop opee This International Standard specifies the form and establishes the interpretation of programs written in the C programmin programming g languag language. e. 1 It specifies — the representat representation ion of C program programs; s; . m o c . l a b o l g i a s . e r o t s o f n i / / : p t t h t a n o i s r e v l l u f e h t s s e c c A . e l p m a s e g a p 9 e e r f a s i s i h T
— the syntax syntax and constraints constraints of the C language; language; — the semantic semantic rules for interpreting interpreting C programs; programs; — the representat representation ion of input data to be processed processed by C programs; programs; — the representat representation ion of output output data data produce produced d by C programs; programs; — the restrictions restrictions and limits imposed by a conforming conforming implementation implementation of C. This International International Standard Standard does does not specify — the mechanism mechanism by which C programs programs are transformed transformed for use by a data-pro data-process cessing ing system; system; — the mechanism mechanism by which C programs programs are invoked invoked for use by a data-proces data-processing sing system; — the mechanism mechanism by which input input data are transf transformed ormed for use by a C program; — the mechanism mechanism by which output output data are transforme transformed d after after being produce produced d by a C program; program; — the size or complex complexity ity of a program program and its data that will exceed exceed the capacity capacity of any specific data-proc data-process essing ing system system or the capacity capacity of a particular particular processo processor; r; — all minimal minimal require requiremen ments ts of a data-pro data-proces cessi sing ng system system that is capa capable ble of supportin supporting g a conforming conforming implementation.
2 Normative Normative refe referenc rences es The following following standa standards rds contain contain provisions provisions which, which, through through reference reference in this text, text, constitut constitutee provisions of this International Standard. At the time of publication, the editions indicated were valid. All standards are subject to revision, and parties to agreements based on this International Standard are encouraged to investigate the possibility of applying the most recent editions of the stand standar ards ds indica indicated ted below below.. Memb Member erss of IEC and and ISO maint maintain ain registe registers rs of curren currently tly valid valid International Standards. ISO 646:1983, 646:1983, Information Information processing processing — ISO 7-bit coded coded characte characterr set f or information information interchange. ISO 4217:1987, Codes Codes for the represe representation ntation of curren currencies cies and funds.
1 This International Standard Standard is designed to promote the portability of C programs among a variety of data-processing data-processing systems systems.. It is intended intended for use by implementors implementors and programmers programmers.. It is accom accompani panied ed by a Rationale Rationale document document that explains many of the decisions decisions of the Technical Technical Committee that that produced i t.
General COPYRIGHT
This is a free preview. preview. Purchase the entire entire publication at the link below:
AS 3955-1991, Programming languages - C . m o c . l a b o l g i a s . e r o t s o f n i / / : p t t h t a n o i s r e v l l u f e h t s s e c c A . e l p m a s e g a p 9 e e r f a s i s i h T
Looking for additional Standards? Visit SAI Global Infostore Subscribe to our Free our Free Newsletters about Australian Standards® in Legislation; ISO, IEC, BSI and more Do you need to Manage Standards Collections Online? Online ? Learn about LexConnect, All Jurisdictions, Standards referenced in Australian legislation Do you want to know when a Standard has changed? Want to become an SAI Global Standards Sales Affiliate? Learn about other SAI Global Services: LOGICOM Military Parts and Supplier Database Metals Infobase Database of Metal Grades, Standards and Manufacturers Materials Infobase Database of Materials, Standards and Suppliers Database of European Law, CELEX and Court Decisions
Need to speak with a Customer Service Representative - Contact Us