Index
- CS225 (OLD ONE IGNORE THIS)
- CS200 (IGNORE THIS TOO)
- GAM200 (YEAH, IGNORE THIS TOO)
- CS180
- Introduction
- Midterm Revision
- Finals Revision
- CS251
- Memory
- ELF Format
- History of Computers
- Stuff to Research
- Quiz To-Do
- OS Architectures
- Week 3
- Week 4
- Week 5
- Week 6 (Threads)
- Week 7 (Scheduling)
- Week 8 (Thread Scheduling)
- Week 9 (Memory Management)
- CS251
- CS225
Misc Notes
Misc Notes
ONLY Misc Notes are written here!
http://stackoverflow.com/questions/7127759/branch-on-operator (Ternary operator efficiency)
http://stackoverflow.com/questions/9476974/why-should-we-use-a-friend-function-to-define-the-comparison-operator (Why we should use friend for comparison)
union is default public accessible
destruction is reverse of construction
void foo(float x, float y)
{
int p = (int) x;
int * p1 = reinterpret_cast<int*>(&x);
int * p2 = reinterpret_cast<int*>(&y);
std::cout<<(*p1<*p2)==(x,y)<<std::endl; //THIS ALWAYS HOLDS because FPU checks are always the same as integer checks
//However this entire thing breaks if it's an unsigned int.
}
{
int p = (int) x;
int * p1 = reinterpret_cast<int*>(&x);
int * p2 = reinterpret_cast<int*>(&y);
std::cout<<(*p1<*p2)==(x,y)<<std::endl; //THIS ALWAYS HOLDS because FPU checks are always the same as integer checks
//However this entire thing breaks if it's an unsigned int.
}