Fichas
COMP 206 Unit 2: Making and Using Objects
Fichas del conjunto (51)
- 1source codeeasy for human to understand
- 2machine instructioncode executed on computer
- 3preprocessorsimple program that replaces patterns in source code with other patterns
- 4preprocesor directivespatterns used to save typing and to increase readability of code
- 5parsesbreaks code into small units and organizes it into a tree
- 6global optimizerused between first and second passes to produce smaller, faster code
- 7code generatorcreates assembly code or machine code
- 8assemblerruns assembly code
- 9peephole optimizerlooks for pieces of code containing redundant assembly-language statement
- 10linkercombines list of object modules into executable program that can be loaded and run by OS
- 11librarycollection of object modules in single file
- 12librarianprogram that creates and maintains libraries
- 13type checkingtests for proper use of arguments in functions and prevents many kinds of programming errors
- 14static type checkingtype checking occurs during compilation; maximizes execution speed
- 15dynamic type checkingtype checking at runtime
- 16interpretertranslates source code into activities and immediately executes activities
- 17compilertranslates source code directly into assembly language or machine instructions
- 18separate compilationpieces of program combined into final executable program by linker
- 19source-level debuggershows exactly what is happening in program by tracing its progress through source code
- 20in-memory compilationkeep compiler program in RAM
- 21compilation process1. run preprocessor on source code
2. first pass: pareses pre-processed code; compiler performs type checking
3. second pass: code generator walks through parse tree and generates assembly/machine code
4. assembler runs code; end result is object module
5. peephole optimizer looks for redundant assembly language
6. linker combines list of object modules into executable program - 22functionspieces of code that can be placed in different files; enabling separate compilation
- 23argumentsvalues you'd like function to work with during execution
- 24return valuevalue that function hands back to you as result
- 25declaration- introduces name (identifier) to compiler
- declare variable/function in many different places
- memory is not allocated - 26definition-allocates storage for name
-only one definition in C or C++
-definition can also be declaration - 27example of function declarationint func1(int, int);
- 28example of function definitionint func1(int length, in width) { }
- 29externdefinition is external to file; definition occurs later in file
- 30header filefile containing external declarations for library
- 31file extension for C++ header file.h
- 32example of including C++ header file- #include
-#include "local.h"
- #include - 33angle brackets- < >
-preprocessor searches for file in way that is particular to your implementation
-"include search path" - 34double quotes-" "
-preprocessor searches for file in "implementation defined way"
-search for file relative to current directory - 353 steps required to use library in C++ program1. include library's header file
2. uses functions and variables in library
3. link library into executable program - 36include statement to use iostream header file#include
- 37namespace-wraps each set of C++ definitions in library/program
-prevents collision if some other definition has identical namespace - 383 things that make up fundamentals of program structure1. variables: holds data used by program
2. function definition
3. function call: program control is transferred to called function - 39compile command for Hello.cppg++ Hello.cpp -o Hello.exe
- 40concatenation-pasting character arrays together into a single character array
- 41iostream for keyboard input-cin
-operator: >> - 42iostream for keyboard output-cout
-operator: << - 43—header file required to read and write files
- 44header file implicitly included when you use fstream
- 45ifstream-input stream; behaves like cin
-opening file for reading - 46ofstream-output stream; behaves like cout
-opening file for writing - 47getline()allows you to read one line into string object
- 48whilereads every line in input file and sends each line to output file
- 49templatecreate class of anything
- 50vectorsequence containers representing arrays that can change in size
- 513 ways vector is container-push_back: add brand-new element to end of vector
-insert(): member function to put something in middle of container
-push_front: put things at beginning
Información
- Descripción
- University-level C++ COMP 206 Fichas sobre COMP 206 Unit 2: Making and Using Objects, creado por Adriana Vincelli-Joma el 05/06/2021.
- Creado por
- Adriana Vincelli-Joma
- Visitas
- 2
- Valoración