資源描述:
《C Traps and Pitfalls》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在學(xué)術(shù)論文-天天文庫(kù)。
1、IrasandPitfalls~ANDREWKOENIGAT&TBellLaboratoriesADDISON"WESLEYPUBLISHINGCOMPANYReading,Massachusetts?MenloPark,California?SydneyDonMills,Ontario?Madrid?SanJuan?NewYork?SingaporeAmsterdam?Wokingham,England?Tokyo?BonnLibraryofCongressCataloging-in-PublicationDataKoenig,Andrew.Ctrap
2、sandpitfalls.Incluqesindex.1.C(Computerprogramlanguage)I.Title.QA76.73.C15K671989005.2688-16616ISBN0-201-17928-~--------AT.TCopyright@1989byAT&TBellLaboratories,Allrightsreserved.Nopartofthispublicationmaybereproduced,storedinaretrievalsystem,ortransmitted,inanyformorbyanymeans,e
3、lectronic,mechan-ical,photocopying,recording,orotherwise,withoutthepriorwrittenpermissionofthepublisher.PrintedintheUnitedStatesofAmerica.Publishedsimultane-ouslyinCanada.ThisbookwastypesetinPalatinoandCourierbytheauthor,usinganAutologicAPS-5phototypesetterandaDECMicroVAXIIc()mpu
4、terrunningthe9thEditionoftheUNIXoperatingsystem.UNIXisaregisteredtrademarkofAT&T.DEC,PDP,andVAXaretrademarksofDigitalEquipmentCorporation.ABCDEFGHIJ-HA-898ToBarbara~whofortoolonghashadfaendureahousefullofdrafts.>PREFACEToolsthatarecomfortableafterexperienceareoftenmoredifficultto
5、learnatfirstthanthosethatfeelrightimmediately.Studentpilotsstartoutovercontrolling,turningfirstflightsintoroller-coasterrides,untiltheylearnhowlightatouchflyingreallyrequires.Trainingwheelsonabicyclemakeiteasierforanovicetoride,butgetinthewayafterthat.Soitisalsowithprogramminglan
6、guages.Everyprogramminglanguagehasaspectsthataremostlikelytocausetroubleforpeoplenotyetthoroughlyfamiliarwiththem.Theseaspectsvaryfromonelanguagetoanother,butaresurprisinglyconstantfromoneprogrammertoanother.Thustheideaofcollectingthem.Myfirstefforttocollectsuchproblemswasin1977,
7、whenIgaveatalkcalledPL/ITrapsandPitfallsattheSHARE(IBMmainframeusers'group)meetinginWashingtonDC.ThatwasshortlyafterImovedfromColumbiaUniversity,wherepeopleused'PL/Iheavily,toAT&TBellLaboratories,wherepeopleuseCheavily.ThedecadethatfollowedgavemeampleexperienceinhowCprogrammers(i
8、ncludingme)cangetthemselvesintotroubleif