Commit 7b9ac582 authored by Eric Krawczyk's avatar Eric Krawczyk
Browse files

first commit: add first 2 lectures

parents
.DS_Store
# EECS 281
## 8 Sep 2015 - Introductions
### Dr. Paoletti
#### Class Materials
- CLRS (Get it, it's the shit)
- C++ stdlib, Wesley, Josuttis
#### Office Hours
- `eecshelp.appspot.com`
- Staff OH on gcal
#### Grading
- 40% Projects
- autograder yo
- 50% exams
- 25% midterm
- 25% final
- WORST BIRTHDAY EVER
- 7pm exam
#### Passing
- >= 50% on projects and >= 50% exams
#### GIT HALLELUJAH
- gitlab.eecs.umich.edu
- THIS IS THE BEST DAY EVER
Don't use cin.eof, .good, .bad, .fail
use
```c++
while( cin >> new_val) {
//exec if new_val read success
}
while (getline(cin, new_line)) {
//samee
}
```
#### GetOpt
- args n shit
```c++
#include <getopt.h>
static struct option longopts[] = {
{"add", no_argument, nullptr, 'a'},
{"delete", required_argument, nullptr, 'd'},
{nullptr, 0, nullptr, 0}
};
```
#### Classes
- order class/struct vars from largest to smallest
- objects (string, etc)
- double
- int
- short
- char
- bool
## EECS 281 - 10 SEP 2015
### Complexity, Runtime, Pseudocode
#### Introductions
- survey on ctools test center
- GetOpt - required_argument
- the arg is not required, but that opt takes an additional value
- no native enforcement of options (eg `a` *must* appear)
- Makefile
- p0 has a makefile template
- this makefile is baller as shit
#### Staff Tips
- write `new` and `delete` in pairs to avoid leaks
- before and after a loop
- use in-class constructors and destructors
- add CLI opts for debugging
- use `-DDEBUG` and `#ifdef DEBUG` for debugging
- code will only appear if you `make debug`
- if DEBUG, use `args` as args, else no args
- ```c++
#ifdef DEBUG
#define _(args) args
#else
#define _(args)
#endif
_(cout << "debug-only msg" << endl;);
```
- Tools
- IDE
- GDB
- Valgrind
- Git (or other version control)
- terminal
- ssh scp, sshfs
- make
- diff, wc, grep, rsync
- DONT `exit(0)`, use `return(0)` instead
- exit(0) will destroy program immediately without any destructors cleanup
- `exit(1)` is fine for exiting with errors
#### make & proj0
- use any file, but Makefile/makefile is default
- defs and build rules
- `#TODO`
- `EXECUTABLE` variable
- `CXX` don't change
- `TESTSOURCES`
- test*
- contain main, won't be built by default
- `SOURCES`
- and corresponding `OBJECTS`
- Select main cpp
- `PROJECTFILE` variable assigned to project*
- Default rules
- `make -R -r` don't use any implicit rules, only use makefile
- `make` `make release` or `make all`
- default compiles everyting with CXXFLAGS
- `make debug`
- compiles with debug, enables `#ifdef DEBUG`
- `make profile` some other fucking shit
- `make_tests` to make exes for test* files
- only creates .o files if older than .cpp, then rebuild to .o, else naw
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment