已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2024年湖北轻工职业技术学院马克思主义基本原理概论期末考试真题汇编
- 2024年四平农村成人高等专科学校马克思主义基本原理概论期末考试真题汇编
- 2025年吉林职业技术学院马克思主义基本原理概论期末考试真题汇编
- 2025年(新)保安员技能考核题含答案解析
- 灭火器检测维修合同
- 应急管理厅安全生产培训课件
- 家族企业知识产权许可合同协议
- 独立董事2026年职责条款
- 企业员工培训与素质发展目标路径制度
- 应急安全培训文案课件
- 2025年煤矿井下电钳工作业理论全国考试题库(含答案)
- 2026年安康旬阳市残疾人托养中心招聘(34人)参考题库附答案
- 病理科TCT课件教学课件
- 清洗吸污合同范本
- 2026哔哩哔哩大年初一联欢会招商方案
- 信息系统安全设计方案
- 2025中国兵器工业集团航空弹药研究院有限公司招聘安全总监1人考试笔试参考题库及答案解析
- 2025年党务工作基层党建知识题库含参考答案
- 事业单位聘用合同范本
- 2025年小学音乐四年级上册国测模拟试卷(人教版)及答案(三套)
- 建设项目水资源论证培训
评论
0/150
提交评论