centralized performance resources
This commit is contained in:
commit
50b15a1522
63 changed files with 328466 additions and 0 deletions
21
ocw/1/c-primer/preprocess.c
Normal file
21
ocw/1/c-primer/preprocess.c
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// Copyright (c) 2012 MIT License by 6.172 Staff
|
||||
|
||||
// All occurences of ONE will be replaced by 1.
|
||||
#define ONE 1
|
||||
|
||||
// Macros can also behave similar to inline functions.
|
||||
// Note that parentheses around arguments are required to preserve order of
|
||||
// operations. Otherwise, you can introduce bugs when substitution happens
|
||||
|
||||
#define MIN(a, b) ((a) < (b) ? (a) : (b))
|
||||
|
||||
int c = ONE, d = ONE + 5;
|
||||
int e = MIN(c, d);
|
||||
|
||||
#ifndef NDEBUG
|
||||
// This code will be compiled only when
|
||||
// the macro NDEBUG is not defined.
|
||||
// Recall that if clang is passed -DNDEBUG on the command line,
|
||||
// then NDEBUG will be defined.
|
||||
if (something) {}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue