On Thu, 22 Sep 2005, Isaac Gouy wrote: > Ara.T.Howard wrote: > -snip- >> line one is an error. >> line two core dumps. >> line three will hang your machine. > > Humbly suggest that C is not the poster child for static type checking > :-) > iirc C is not even considered to be type safe. c is 100% staticly typed. no exception. static typing means types are know at compile type are cannot be changed via that execution path. note that this is not the same as weak typing. c is also weakly typed - meaning that the programmer can change the type of an expression (cast). note that doing so is a __compile_time__ operation and cannot be done at run time so, even though you can write this fprintf ("%s", (char *) 42); and abuse the absence of string typing (arguments to methods cannot be given the wrong type) the compiler still knows this __before__ your code execute and is, therefore know statically. c is not a poster child for strong typing - while, ironically, ruby is. c : static/weak type c++ : static/weak type ocaml : static/strong type java : static/strong type perl : dynamic/weak type ruby : dynamic/strong type python : dynamic/strong type only the combination of static and strong typing can allow a compiler to ensure program correctness. note, however, that it's impossible to do any generic programming without also having a type inference system (a la ocaml) or code generation system (a la c++). eg, if c were static and strongly typed you could not write int pthread_create (pthread_t * thread, pthread_attr_t * attr, void *(*start_routine) (void *), void *arg); and i c++ you could not write int foo (BaseClass *obj); unless you did so using templates. only with a system that is both strongly typed, statically typed, and uses type inference could you write something like let rec sort = function | [] -> [] | x :: l -> insert x (sort l) and insert elem = function | [] -> [elem] | x :: l -> if elem < x then elem :: x :: l else x :: insert elem l;; sort [2; 1; 0];; - : int list = [0; 1; 2] sort ["yes"; "ok"; "sure"; "ya"; "yep"];; - : string list = ["ok"; "sure"; "ya"; "yep"; "yes"] and have the compiler verify that it is correct and wil not core dump, etc. without writing, by hand, a duplicate method for all possible type - which is what c++ templates effectively do, though making a program verifiably correct would require their use exclusively and removal of type promotion rules, among other things. strangely noone suggests that c++ or java are not feasbile for large project and advocate ocaml instead. i really think this is more of a paradigm issue that any real issue. > The OP was unhelpfully vague about what he considered to be large > programs but imo 25,000 lines of java equivalent doesn't seem at all > large. but it makes me sick just thinking about it. no program should be that big - just like no soda should be 64 ounces. > The OP also mentioned "programming in the large" which perhaps implies > co-ordinating multi-person development. and weeks of memory leak debugging. i'm just kidding on those last two. ;-) cheers. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | Your life dwells amoung the causes of death | Like a lamp standing in a strong breeze. --Nagarjuna ===============================================================================