已阅读5页,还剩42页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1,ATourofComputerSystems(2),C,2,Outline,LayersofcomputersystemsSuggestedreading4asidesinchapter1,CompilersAutumn2002,3,LayersofComputerSystems,CompilersAutumn2002,4,Utilities,ProgramminglanguageANSICCompilerGNU-gccToolsGNUtoolchain,eclipse(CDT),CompilersAutumn2002,5,GNU,FreesoftwareRichardStallman,1984AcompleteUnix-likesystemwithsourcecodeAnenvironmentAllmajorcomponentsofaUnixoperatingsystemExceptforkernel,CompilersAutumn2002,6,Platforms,HardwareplatformIntelIA-32OperatingsystemLinuxProgramminglanguageANSICUtilityGNU,eclipse(CDT)C,CompilersAutumn2002,7,RepresentationandManipulationInformation(1),C,8,Outline,BitandByteUnderstandmachinerepresentationsofnumbersSuggestedreading2.1.1,CompilersAutumn2002,9,WhyBit?,ModerncomputersstoreandprocessInformationrepresentedastwo-valuedsignalsTheselowlybinarydigitsarebitsBitsformthebasisofthedigitalrevolution,CompilersAutumn2002,10,TheDecimalRepresentation,Base-10Hasbeeninuseforover1000yearsDevelopedinIndiaImprovedbyArabmathematiciansinthe12thcenturyBroughttotheWestinthe13thcenturybytheItalianmathematicianLeonardoPisano,betterknownasFibonacci.,CompilersAutumn2002,11,WhyBit?,Usingdecimalnotationisnaturalforten-fingeredhumansButbinaryvaluesworkbetterwhenbuildingmachinesthatstoreandprocessinformation,CompilersAutumn2002,12,WhyBit?,Two-valuedsignalscanreadilyberepresented,stored,andtransmitted,ExamplesThepresenceorabsenceofaholeinapunchedcardAhighorlowvoltageonawireAmagneticdomainorientedclockwiseorcounterclockwise.,CompilersAutumn2002,13,WhyBit?,Theelectroniccircuitryisverysimpleandreliableforstoringandperformingcomputationsontwo-valuedsignalsThisenablingmanufacturerstointegratemillionsofsuchcircuitsonasinglesiliconchip,CompilersAutumn2002,14,GroupBits,Inisolation,asinglebitisnotveryusefulInEnglish,thereare26(or52)charactersinitsalphabet.TheyarenotusefuleitherinisolationHowever,thereareplentyofwordsinitsvocabulary.Howisthisachieved?Similarly,weareabletorepresenttheelementsofanyfinitesetbyusingbits(insteadofbit),CompilersAutumn2002,15,GroupBits,Todothis,wefirstgroupbitstogetherthenapplysomeinterpretationtothedifferentpossiblebitpatternsthatgivesmeaningtoeachpatterns8-bitchunksareorganizedasabyteDr.WernerBuchholzinJuly1956duringtheearlydesignphasefortheIBMStretchcomputer,CompilersAutumn2002,16,ValueofBits,Bits01010Value0*24+1*23+0*22+1*21+0*20=10Value102(1100110)Bits102=51*2+0(0)51=25*2+1(1)25=12*2+1(1)12=6*2+0(0)6=3*2+0(0)3=1*2+1(1)1=0*2+1(1),CompilersAutumn2002,17,GroupbitsasnumbersThreeencodings,UnsignedencodingRepresentingnumbersgreaterthanorequalto0UsingtraditionalbinaryrepresentationTwos-complementencodingMostcommonwaytorepresenteitherpositiveornegativenumbersFloatingpointencodingBase-twoversionofscientificnotationforrepresentingrealnumbers,CompilersAutumn2002,18,GroupbitsasnumbersUnderstandingnumbers,MachinerepresentationofnumbersarenotsameasIntegersandrealnumbersTheyarefiniteapproximationstointegersandrealnumbersSometimes,theycanbehaveinunexpectedway,CompilersAutumn2002,19,intisnotinteger,Overflow200*300*400*500=-884,901,888ProductofasetofpositivenumbersyieldedanegativeresultCommutativity,Fileinclusion,StandardLibrary,Headerfile,CompilersAutumn2002,29,FileInclusionandMacroSubstitution,MacroSubstitution,intj;main()return100+j;,CompilersAutumn2002,30,FileInclusionandMacroSubstitution,#include“filename”#include#defineforeverfor(;)/*infiniteloop*/#definesquare(x)(x)*(x),CompilersAutumn2002,31,FormattedOutput-Printf,intprintf(char*format,arg1,arg2,)printf(“%d,%dn”,i,j);%d,%idecimalnumber%ooctalnumber(withoutaleadingzero)%x,%Xhexadecimalnumber%csinglecharater,CompilersAutumn2002,32,IntegraldatatypeinC,ThereareseveraldatatypetorepresentintegersinCThedifferenceisthesizeoftheintegerItreflectstheimplementationofhardware,CompilersAutumn2002,33,TheContextofaCompiler(gcc),Sourceprogram(text),hello.c,CompilersAutumn2002,34,TheHelloProgram,SourceprogramCreatedbyeditorandsavedasatextfileBeginslifeasahigh-levelCprogramCanbereadandunderstandbyhumanbeingsTheindividualCstatementsmustbetranslatedbycompilerdriversSothatthehelloprogramcanrunonacomputersystem,CompilersAutumn2002,35,TheHelloProgram,TheCprogramsaretranslatedintoAsequenceoflow-levelmachine-languageinstructionsTheseinstructionsarethenpackagedinaformcalledanobjectprogramObjectprogramarestoredasabinarydiskfileAlsoreferredtoasexecutableobjectfiles,CompilersAutumn2002,36,Preprocessor,MacroSubstitution,Obtainwithcommandgcc-Ea.cSourcefilea.i,#1a.c#1#1#1a.c#1b.h1intj;#2a.c2main()return100+j;,CompilersAutumn2002,37,SourceCodeandAssemblyCode,Globalvariable,CompilersAutumn2002,38,MachineCode,CompilersAutumn2002,COMPILING,P,39,SourceCodes*.c,*.h,CProgramPreprocessor,SourceCodes*.i,CProgramCompiler,AssemblyCodes*.s,Assembler,Linker/Loader,GNUCompilerCollection,E,c,o,S,BinaryCodes*.out,BinaryCodes*.o,40,TheCProgrammingLanguage,Cwasdevelopedin1969to1973byDennisRitchieofBellLaboratories.TheAmericanNationalStandardsInstitute(ANSI)ratifiedtheANSICstandardin1989.ThestandarddefinestheClanguageandasetoflibraryfunctionsknownastheCstandardlibrary.,CompilersAutumn2002,41,TheCProgrammingLanguage,KernighanandRitchiedescribeANSICintheirclassicbookwhichisknownaffectionatelyas“K&R”.InRitchieswords,Cisquirky,flawed,andanenormoussuccess.Whythesuccess?,CompilersAutumn2002,42,TheCProgrammingLanguage,CwascloselytiedwiththeUnixoperatingsystemCwasdevelopedfromthebeginningasthesystemprogramminglanguageforUnix.MostoftheUnixkernel,andallofitssupportingtoolsandlibraries,werewritteninC.,CompilersAutumn2002,43,TheCProgrammingLanguage,CwascloselytiedwiththeUnixoperatingsystemAsUnixbecamepopularinuniversitiesinthelate1970sandearly1980s,manypeoplewereexposedtoCandfoundthattheylikedit.SinceUnixwaswrittenalmostentirelyinC,itcouldbeeasilyportedtonewmachines,whichcreatedanevenwideraudienceforbothCandUnix.,CompilersAutumn2002,44,TheCProgrammingLanguage,Cisasmall,simplelanguage.Thedesignwascontrolledbyasingleperson,ratherthanacommittee,andtheresultwasaclean,consistentdesignwithlittlebaggage.TheK&Rbookdescribesthecompletelanguageandstandardlibrary,withnumerousexamplesandexercises,inonly261pages.ThesimplicityofCmadeitrelativelyeasytolearnandtoporttodifferentcomputers.,CompilersAutumn2002,
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025年度企事业单位综合信息化系统建设与运维合作协议
- 2025年度铣刨机租赁及配套服务全面合作协议
- 2025年企业环境风险评估与治理服务合同
- 2025年企业级TOCC信息系统集成与安全保障服务合同
- 2025年度高端音乐厅年度场地使用权及配套服务合同
- 2025年智能金融平台生态圈共建合作协议
- 2025年城市景观提升项目专业吊车租赁与施工服务合同
- 2025-2030礼品包装行业市场细分与目标客户选择及精准营销分析报告
- 2025年度留学生海外院校住宿与生活综合管理服务合同
- 2025年度影视作品著作权集体管理及归属权协议
- 王阳明传人物传记人物介绍
- 【培训课件】商务礼仪培训
- 政府机关员工宿舍管理条例
- 难治性尿路感染中医治疗
- 消除三病母婴传播
- 银行零售业务培训
- 交叉持股合同范本
- 新课标语文整本书阅读教学课件:童年(六下)
- 幼升小语文拼音测试卷
- 承建工程合作意向书2024年标准版
- 临床护理应急演练脚本
评论
0/150
提交评论