'&$%CSE 303:Concepts and Tools for Software DevelopmentDan GrossmanSpring 2005Lecture 22— Generics, function pointers, void*Dan Grossman CSE303 Spring 2005, Lecture 22 1'&$%Where are WeWhat I thought today was: version-control, e.g., cvsWhat we better do based on questions: interfaces, generics,function-pointers, void*, passing pointers (to pointers).A “new” approach: Analogous code in Java and C, starting with Java.Dan Grossman CSE303 Spring 2005, Lecture 22 2'&$%Very-High-Level Points• Flexible “interfaces” often involve function-pointers.– You need “environments” so the function-pointers can havethe data they need.• Object and void* are analogous– And poor substitutes for type variables (Java 1.5) or arguablytemplates (C++) bec ause you have to cast a lot.• Homework 5/6 has one technique not in the example: functionpointers that mutate their environment to “remembe r where theyare”.Dan Grossman CSE303 Spring 2005, Lecture 22
View Full Document