加入VIP
  • 专属下载特权
  • 现金文档折扣购买
  • VIP免费专区
  • 千万文档免费下载

上传资料

关闭

关闭

关闭

封号提示

内容

首页 c标准库

c标准库.pdf

c标准库

haore147
2011-05-15 0人阅读 举报 0 0 暂无简介

简介:本文档为《c标准库pdf》,可适用于IT/计算机领域

THESTANDARD<stdiohAypeh>*ringh><math$cstdlibh>*i:iserth><stdar:I:<setjmph>*<signah><time<imitsh>*<flath><stddei:<errnoh>*<localeh><stdio,<ctypeh>*<stingh><mathstdlibh>*t:(,erth><stdargh:Ltimph>rnah><timeh>*(floath><stddefh>*<ermoh>*<localeh>LIBRARYPJPLAUCERTHESTANDARDLIBRARYIJPLAUCERTHESTANDARDCLIBRARYshowsyouhowtouseallofthelibraryfunctionsmandatedbytheANSIandISStandardsfortheprogramminglanguageCTohelpyouunderstandhowtousethelibrary,thisbookalsoshowsyouhowtoimplementitYouseeapproximately,linesoftested,workingcodethatishighlyportableacrossdiversecomputerarchitecturesTHESTANDARDCLIBRARYexplainshowthelibrarywasmeanttobeusedandhowitcanbeusedItplacesparticularemphasisonfeaturesaddedtoCaspartoftheCStandardThesefeaturesincludesupportformultiplelocales(culturalconventions)andverylargecharactersets(suchasKanji)ThecodepresentedinthisbookhasbeentestedwithCcompilersfromBorland",Saberm,ProjectGnu,SunF,UNIXF,andVAXF,ULTRIXFIthaspassedthewidelyusedPlumHallValidationSuitemtestsforlibraryfunctionsIthasalsosurvivedanassortmentofpublicdomainprogramsdesignedtostressCimplementationsandilluminatetheirdarkercornersThemathematicalfunctionsareparticularlywellengineeredandtestedFinally,THESTANDARDCLIBRARYshowsyoumanyprinciplesoflibrarydesigningeneralYoulearnhowtodesignandimplementlibrariesthatarehighlycohesiveandreusableIJPlaugerisoneoftheoriginalusersoftheCprogramminglanguageHechairedtheLibrarySubcommitteeofXJtheANSIauthorizedcommitteethatdevelopedtheCStandardHecontinuesasSecretarytoXJllandConvenorofWG,theISOauthorizedcommitteedevelopingfurtherenhancementsottheCStandardDrPlaugeriscoauthor(withBrianKernighan)ofseveralhighlyacclaimedbooks,includingSOFTWARETOOLS,SOFTWARETOOLSINPASCAL,andTHEELEMENTSOFPROGRAMMINGSTYLEWithJimBrodie,ChairofXJl,hecoauthoredSTANDARDC,acompletereferencetotheCProgrammingLanguagePRENTICEHALLPTREnglewoodCliffs,NJTHESTANDARDLIBRARYPJPlaugerPrenticeHallPTREnglewoodCliffs,NewJerseyLlbraryofCongressCataloglnglnPubllcatlonDataPlaugerPJTheStandaroClibrary!PJPlaugerpcmIncludesbibliographlcalreferencesandindexISBN(casebound)ISBN(paperbound)C(Computerprogramlanguage)ITitleQAClP'dcCIPEditoriallproduct~onsupervision:BrendanMStewartManufacturingbuyers:KellyBehrandSusanBrunkebyPJPlaugerPublishedbyPrenticeHallPTRPrenticeHallIncASimonSchusterCompanyEnglewoodCliffsNewJerseyTheauthorandpublisherhaveusedtheirbesteffortsinpreparingthisbookTheseeffortsincludethedevelopment,research,andtestingoftheprogramstodeterminetheireffectivenessTheauthorandpublishermakenowarrantyofanykid,expressedorimplied,withregardtotheseprogramsorthedocumentationcontainedinthisbookTheauthorandpublishershallnotbeliableinanyeventforincidentalorconsequentialdamagesinconnectionwith,orarisingoutof,thefurnishing,performance,oruseoftheseprogramsAllrightsreservedNopartofthisbookmaybereproduced,inanyformorbyanymeans,withoutpermissioninwritingoftheauthaYoumayuseandredistributethecodefragmentsinthisbookwithoutroyaltyorfeeonlyaspartofexecutableimages,andonlyprovidedthatthefollowingnoticeisincludedprominentlyintheassociateddocumentationandaspartoftheexecutableimage:PortionsofthisworkarederivedfranTheStandardCLibrary,copyright(c)byPJPlauger,publishedbyPrenticeHall,andareusedwithpermissionForadditionallicensingofthecode,seepage$PrintedintheUnitedStatesofAmericaRenticeHallInternational(UK)Limited,LondonRenticeHallofAustraliaPtyLimited,SydneyRenticeHallofCanadaInc,TorontoRenticeHallHispanoamericana,SA,MexicoRenticeHallofIndiaPrivateLimited,NmDehliRenticeHallofJapan,Inc,TokyoSimonSchusterAsiaPteLtd,SingaporeEditoraPrenticeHalldoBrasil,Ltda,RiodeJanerioforTanaPERMISSIONSExcerptsfromtheISCStandard,ISOIEC:,reprintedbypermissionoftheInternationalStandardsOrganization,GenevaThecompleteStandard,andtheotherISstandardsreferredtointhisbook,maybepurchasedfromtheISmemberbodiesordirectlyfrom:ISCentralSecretariatCasepostaleGenevaSWITZERLANDExcerptsfromWilliamJCody,JrandWilliamWaite,SoftwareManualfortheElementayFunctions,O,pp,,,,,,,andreprintedbypermissionofRenticeHall,EnglewoodCliffs,NewJerseyExcerptsfromPPlaugerandJimBrodie,StandardC,reprintedbypermissionoftheauthorsExcerptsfrmPJPlauger,StandardC,monthlycolumninTheCUsersJournal,reprintedbypermissionoftheauthorTRADEMARKSCompaqSLTsisatrademarkofCompaqComputerCorporationCorelDrawisatrademarkofCorelSystemsIBMPCandSystemaretrademarksofIBMCorporationMacintoshisatrademarkofAppleComputerMSDOS,andWindowsaretrademarksofMicrosoftCorporationMulticsisatrademarkofHoneywellBullPDP,RSXIIM,ULTRIX,andVAXaretrademarksofDigitalEquipmentCorporationTurboCisatrademarkofBorland,InternationalUNIXisatrademarkofATTBellLaboratoriesVenturaPublisherisatrademarkofventuraSoftwareIncTYPOGRAPHYThisbookwastypesetinPalatino,AvantGarde,andCourierboldbytheauthorusingaCompaqSLTscomputerrunningventuraPublisherandCorelDrawunderMicrosoftWindowsContentsPrefaceTheCodeAcknowledgmentsChapter:IntroductionBackgroundWhattheCStandardSaysUsingtheLibrarylmplementingtheLibraryTestingtheLibraryReferencesExercisesChapter:<asserth>BackgroundWhattheCStandardSaysUsing<asserth>lmplementing<asserth>Testing<asserth>ReferencesExercisesChapter:<ctypeh>BackgroundWhattheCStandardSaysUsing<ctypeh>lmplementingKctypeh>TestingKctypeh>ReferencesExercisesChapter:<errnoh>BackgroundWhattheCStandardSaysUsing<errnoh>lmplementing<errnoh>Testing<errnoh>ReferencesExercisesixxiixiiiChapter:<floath>BackgroundWhattheCStandardSaysUsing<floath>lmplementing<floath>Testing<floath>ReferencesExercisesChapter:<limitsh>BackgroundWhattheCStandardSaysUsing<limitsh>lmplementing<limitsh>Testing<limitsh>ReferencesExercisesChapter:<localeh>BackgroundWhattheCStandardSaysUsing<localeh>lmplementing<localeh>Testing<localeh>ReferencesExercisesChapter:<mathh>BackgroundWhattheCStandardSaysUsing<mathh>lmplementing<mathh>Testing<mathh>ReferencesExercisesChapter:<setjmph>BackgroundWhattheCStandardSaysUsing<setjmph>lmplementing<setjmph>Testing<setjmph>ReferencesExercisesChapter:<signalh>BackgroundWhattheCStandardSaysUsing<signalh>lmplementing<signalh>Testing<signalh>ReferencesExercisesChapter:<stdargh>BackgroundWhattheCStandardSaysUsing<stdargh>lmplementingxstdargh>Testingcstdargh>ReferencesExercisesChapter:<stddefh>BackgroundWhattheCStandardSaysUsing<stddefh>lmplementing<stddefh>Testing<stddefh>ReferencesExercisesChapter:<stdioh>BackgroundWhattheCStandardSaysUsing<stdioh>lmplementing<stdioh>Testing<stdioh>ReferencesExercisesChapter:<stdlibh>BackgroundWhattheCStandardSaysUsingKstdlibh>lmplementing<stdlibh>Testing<stdlibh>ReferencesExercisesChapter:<stringh>BackgroundWhattheCStandardSaysUsing<stringh>Implementing<stringh>Testing<stringh>ReferencesExercisesChapter:<timeh>BackgroundWhattheCStandardSaysUsing<timeh>Implementing<timeh>Testing<timeh>ReferencesExercisesAppendixA:InterfacesAppendixB:NamesAppendixC:TermsIndexThisbookshowsyouhowtouseallthelibraryfunctionsmandatedbytheANSIandISStandardsfortheprogramminglanguageCIhavechosentofocusonthelibraryexclusively,sincemanyotherbooksdescribethelanguageproperThebookalsoshowsyouhowtoimplementthelibraryIpresentabout,linesoftested,workingcodeIbelievethatseeingarealisticimplementationoftheStandardClibrarycanhelpyoubetterunderstandhowtouseitAsmuchaspossible,thecodeforthelibraryiswritteninStandardCTheprimarydesigngoalistomakethecodeasreadableandasexemplayaspossibleAsecondarygoalistomakethecodehighlyportableacrossdiversecomputerarchitecturesStillanothergoalistopresentcodethatmakessensibletradeoffsbetweenaccuracy,performance,andsizeTeachingyouhowtowriteCisnotagoalofthisbookIassumeyouknowenoughaboutCtoreadstraightforwardcodeWherethecodepresentedisnotsostraightforward,IexplainthetrickeryinvolvedtheTheStandardClibraryisfairlyambitiousItprovidesconsiderableStandardpowerinmanydifferentenvironmentsItpromiseswelldefinednameClibraryspacesforbothuserandimplementorItimposesfairlystrictrequirementsontherobustnessandprecisionofitsmathematicalfunctionsAnditpioneersinsupportingcodethatadaptstovariedcultures,includingthosewithverylargecharactersetsTobenefitfromtheseambitions,ausershouldbeawareofnumeroussubtletiesTosatisfytheseambitions,animplementormustprovideforthemThesesubtletiesarenotalwaysaddressedintheCStandardproperItisnottheprimarypurposeofastandardtoeducateimplementorsNoraremanyofthesesubtletieswellexplainedintheRationalethataccompaniestheANSICStandardARationalemustserveseveralmasters,onlyoneofwhomistheinquisitiveimplementorThepioneeringfeaturesImentionedabovearenotfoundintraditionalimplementationsofCAnimplementationcannowsupportmultiplelocalesEachlocalecapturesnumerousconventionspeculiartoacountry,language,orprofessionACprogramcanalterandquerylocalestoadaptdynamicallytoabroadrangeofculturesAnimplementationcanalsonowsupportverylargecharactersets,suchastheKanjicharactersusedinJapanPrefaceACprogramcanmanipulatesuchcharactersetseitherasmultibytecharactersoraswidecharactersItcanalsotranslatebetweenthesetwoformsThatsimplifies,andstandardizes,thewritingofprogramsforthisrapidlygrowingmarketplaceLittleornopriorartexistsforthesenewfeaturesHence,eventhemostexperiencedCprogrammersneedguidanceinusinglocales,multibytecharacters,andwidecharactersParticularattentionisgivenheretothesetopicssubtletiesThisbookexplains,forusersandimplementorsalike,howthelibrarywasmeanttobeusedandhowitcanbeusedByprovidingaworkingimplementationofallthefunctionsintheStandardClibrary,thebookshowsbyexamplehowtodealwiththeirsubtletiesWherenoimplementationisclearlythebest,italsodiscussesalternativesandtradeoffsAnexampleofthesubtletiesinvolvedisthefunctiongetcharTheheader<stdioh>can,inprinciple,maskitsdeclarationwiththemacro:#definegetchar()fgetc(stdin)*NOTWISE!*Itmustnotdoso,howeverAvalid(ifuseless)Cprogramis:#include<stdioh>#undeffgetcintmain(void){intfgetc=getchar()*PRODUCESAMYSTERIOUSERROR*return()TheexampleisadmittedlyperverseNevertheless,itillustratespracticesthatevenawellmeaningprogrammermightindulgeUsershavetherighttoexpectfew,ifanysurprisesofthisilkImplementorshaveanobligationtoavoidcausingsuchsurprisesTheformIsettledonforthegetcharmacrois:#definegetchar()(FilesOl>Next<Files>end*~ilesO>Next:(getchar))Itisafarcryfromtheobvious(andmorereadable)formfirstpresentedaboveChapter:<stdioh>helpsexplainwhydesigningStillanotherpurposeofthisbookistoteachprogrammershowtodesignlibrariesandimplementlibrariesingeneralByitsverynature,thelibraryprovidedwithaprogramminglanguageisamixedbagAnimplementorneedsabroadspectrumofskillstodealwiththevariedcontentsofthebagItisnotenoughtobeacompetentnumericalanalyst,ortobeskilledinmanipulatingcharacterstringsefficiently,ortobeknowledgeableinthewaysofoperatingsysteminterfacingWritingalibrarydemandsalltheseskillsandmoreGoodbookshavebeenwrittenonhowtowritemathematicalfunctionsOtherbookspresentspecializedlibrariesforavarietyofpurposesTheyshowyouhowtousethelibrarypresentedSomemayevenjustifymanyPrefaceGoodbookshavebeenwrittenonhowtowritemathematicalfunctionsOtherbookspresentspecializedlibrariesforavarietyofpurposesTheyshowyouhowtousethelibrarypresentedSomemayevenjustifymanyofthedesignchoicesfortheparticularlibraryinquestionFaY,ifany,endeavortoteachtheskillsrequiredforlibrarybuildingingeneralreusabilityAnumberofbookspresentgeneralprinciplesfordesigningandimplementingsoftwareThedisciplinestheypresenthavenamessuchasstructuredanalysis,structureddesign,objectorienteddesign,andstructuredprogrammingMostexamplesinthesebooksconsideronlyprogramswrittenforacustomapplicationNevertheless,theprinciplesanddisciplinesapplyequallywelltothewritingofreusablelibrariesThegoalofreusabilitysimplyraisesthestakesIfalibraryfunctionisnothighlycohesive,inthestructureddesignsense,thenitislesslikelytofindnewusesIfitdoesnothavelowcoupling,inthesamesense,itishardertouseSimilarly,acollectionoffunctionsmusthideimplementationdetailsandprovidecompletefunctionalityOtherwise,theyfailatirnplementingreusabledataabstractions,intheobjectorientedsenseSothefinalpurposeofthisbookistoaddressthedesignandimplementationissuespeculiartolibrarybuildingThedesignoftheStandardClibraryisfixedNevertheless,itisagooddesigninmanywaysandworthyofdiscussionImplementationsoftheStandardClibrarycanvaryAnynumberofchoicesarestronglydictatedbygeneralprinciples,suchascorrectnessandmaintainabilityOtherchoicesaredictatedbyprioritiespeculiartoaproject,suchasveryhighperformance,portabilityorsmallsizeThesechoicesandprinciplesarealsoworthyofdiscussionstructureThebookisstructuredmuchliketheStandardClibraryitselfFifteenofthisheadersdeclareordefineallthenamesinthelibraryAseparatechapterbookcoverseachheaderMostoftheheadershavereasonablycohesivecontentsThatmakesforreasonablycohesivediscussionsOneortwo,however,arecatchallsTheircorrespondingchaptersareperforcewiderrangingIincludeineachchapterexcerptsfromrelevantportionsoftheISCStandard(Asidefromformattingdetails,theISandANSICStandards,areidentical)TheexcerptssupplementthenarrativedescriptionofhoweachportionofthelibraryiscustomarilyusedTheyalsohelpmakethisbookamorecompletereference(thatisneverthelessmorereadablethantheCStandardalone)IalsoshowallcodeneededtoimplementthatportionandtotesttheimplementationEachchapterendswithreferencesandasetofexercisesInauniversitycoursebasedonthisbook,theexercisescanserveashomeworkproblemsManyofthemaresimpleexercisesincoderewritingTheydrivehomeapointorillustratereasonablevariationsinimplementationThemoreambitiousexercisesarelabelledassuchTheycanserveasabasisformoreextendedprojectsTheindependentreadercansimplyusetheexercisesasanimpetusforfurtherthoughtxiiPrefaceTheCodeThecodepresentedinthisbookhasbeentestedwithCcompilersfromBorland,ProjectGNU,andVAXULTRIXIthaspassedthewidelyusedPlumHallValidationSuitetestsforlibraryfunctionsIthasalsosurvivedanassortmentofpublicdomainprogramsdesignedtostressCimplementationsandilluminatetheirdarkercornersWhileIhavetakenpainstominimizeerrors,IcannotguaranteethatnoneremainPleasenotethedisclaimeronthecopyrightpagePleasenotealsothatthecodeinthisbookisprotectedbycopyrightIthasnotbeenplacedinthepublicdomainNorisitsharewareItisnotprotectedbya"mpyleft"agreement,likecodedistributedbytheFreeSoftwareFoundation(ProjectGNU)IretainallrightsfairuseYouarewelcometotranscribethecodetomachinereadableformforyourpersonaluseYoucanpurchasethecodeinmachinereadablefromTheCUsersGroupinLawrence,KansasIneithercase,whatyoudowiththecodeislimitedbythe"fairuse"provisionsofcopyrightlawFairusedoesnotpermityoutodistributecopiesofthecode,eitherhardcopyormachinereadable,eitherfreeorforafeeHavingsaidthat,IdopermitoneimportantusagethatgoeswellbeyondfairuseYoucancompileportionsofthelibraryandlinktheresultantbinaryobjectmoduleswithyourowncodetoformanexecutablefileIherebypermityoutodistributeunlimitedcopiesofsuchanexecutablefileIasknoroyaltyonanysuchcopiesIdo,however,requirethatyoudocumentthepresenceofthelibrary,whateveramountyouuse,eithermodifiedorunmodifiedPleaseincludesomewhereintheexecutablefilethefollowingsequenceofcharacters:miomofthismkarederivedfrnm'IheStandardCLihary,it(c)WPJP,publishedWPrenticeHall,ardareueedwithpnnissirnThesamemessageshouldappearprominently,andinanappropriateplace,onanydocumentationthatyoudistributewiththeexecutableimageIfyouomiteithermessage,youinfringethecopyrightlicensingYoucanalsoobtainpermissiontodomoreYoucandistributetheentirelibraryintheformofbinaryobjectmodulesYoucanevendistributecopiesofthesourcefilesfromthisbook,eithermodifiedorunmodifiedYoucan,inshort,incorporatethelibraryintoaproductthatletspeopleuseittomakeexecutableprogramsTodoso,however,requiresalicenseYoupayafeeforthelicenseContactPlumHallIncinKamuela,HawaiiforlicensingtermsandforongoingsupportofthelibraryDespitethemercenarytoneoftheseparagraphs,myprimarygoalisnotto

用户评价(7)

  • 10.69.3.32 英文啊,看着吃力啊

    2012-12-12 04:58:38

  • haotaer 好书啊 这本书我在图书馆看了好几遍 堪称经典中的经典 让你有木看到林,在有林看到森! 强力推荐大家买一本珍藏啊!

    2012-06-17 21:00:56

  • 172.16.205.11 好书

    2012-05-14 01:00:18

  • 172.16.205.13 好书

    2012-05-14 00:59:56

  • 172.16.181.12 好书啊 这本书我在图书馆看了好几遍 堪称经典中的经典 让你有木看到林,在有林看到森! 强力推荐大家买一本珍藏啊!

    2012-03-04 04:40:57

点击加载更多内容
关闭

新课改视野下建构高中语文教学实验成果报告(32KB)

抱歉,积分不足下载失败,请稍后再试!

提示

试读已结束,如需要继续阅读或者下载,敬请购买!

文档小程序码

使用微信“扫一扫”扫码寻找文档

1

打开微信

2

扫描小程序码

3

发布寻找信息

4

等待寻找结果

我知道了
评分:

/49

c标准库

仅供在线阅读

VIP

在线
客服

免费
邮箱

爱问共享资料服务号

扫描关注领取更多福利