3156-22 - COMS W3156 Software Engineering Fall 2001...

Info iconThis preview shows pages 1–11. Sign up to view the full content.

View Full Document Right Arrow Icon
COMS W3156: Software Engineering, Fall 2001 Lecture #22: C, C++, OS, etc… Janak J Parekh [email protected]
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Administrativia Prototype is in: enough for integration Our work never finishes: now working on reference model If problems with the prototype, come see us early Final exam: any questions? Open book doesn’t mean easier… Reminder: Research Fair this Friday http://acm.cs.columbia.edu/research Intro to Java Server pages and Servlets tomorrow See CS front doors…
Background image of page 2
Next class Finish everything Monday will be MMM and final exam review Can you believe the semester has less than two weeks left?
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Today’s class A little bit more on C C++ Begin operating systems Begin design patterns, if time
Background image of page 4
Struct Basically, a class without methods struct Point { int x; int y; }; /* note the semicolon */ int main(void) { struct Point myPoint; myPoint.x = 5; myPoint.y = 5; }
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Miscellany on structs (*myP).x looks ugly C has a bizarre shortcut: myP -> x Yes, a dash followed by a greater than Always remember that a -> b is equivalent to (*a).b Precedence of operators It’s cumbersome to have to say struct Point every time Use typedefs: define “aliases” typedef struct Point PointT; or even typedef struct Point *PointP;
Background image of page 6
More miscellany on structs Since not everything happens in main, malloc’ing structs is very common The sizeof operator works on pretty much any datatype, be it structs or primitive datatypes Guaranteed tip: you will come across PointP myP = (PointP)malloc(sizeof(Poin tP)); and be glad that you were attending this class…
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Function prototypes As I said, C’s compiler is not all that smart If you have: int main(void) { int i = foo(); } int foo(void) { return 5; } It will not work
Background image of page 8
Function prototypes (II) Need to clue in the compiler by putting the following prototype before main: int foo(void); Looks like a Java interface construct Often, you collect the prototypes into a header (.h) file, then #include it into your various source (.c) files
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
On various .c files… A common way to build multi-source-file code in C is to build a set of .h files that export functionality (i.e. “public” methods)
Background image of page 10
Image of page 11
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/09/2010 for the course COMS W3156 taught by Professor Janakjparekh during the Fall '01 term at Columbia.

Page1 / 35

3156-22 - COMS W3156 Software Engineering Fall 2001...

This preview shows document pages 1 - 11. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online