rcd@opus.UUCP (Dick Dunn) (01/25/85)
> > I wonder whether this is widespread. The problem with safety devices > > is that people rely on them to do their thinking for them in situations > > where they shouldn't. > I don't think this is a property of safety devices. I don't get the > impression that people drive worse if they're wearing a safety belt, for > instance. I like to have safety devices in programs to protect me when my > thinking fails, rather than to save me thinking. A while back, I worked for about six months in a situation where I was switching between C and Pascal on almost a daily basis. The real problem was neither with C nor with Pascal, but with the context switch that had to happen in my head. In Pascal, it's perfectly reasonable to change the type of a variable or the parameters of a procedure, fix what you can find, and let the compiler find the rest. In C, there's a big chance that there will be errors that the compiler won't catch. If you've got your head in the state where you're counting on the compiler to catch a certain class of bugs for you (faster than you can find them yourself, in many cases), you'll get screwed when you switch over to C. After you adapt to the (comparatively) paranoid state of programming in C, you switch back to Pascal and at worst you spend a lot of time finding things the compiler could find instead. [This whole business is offset by C's greater freedom--when I switch to Pascal from C I find myself having to recast problems to fit within Pascal's rules. But that's another discussion.] -- Dick Dunn {hao,ucbvax,allegra}!nbires!rcd (303)444-5710 x3086 ...Keep your day job 'til your night job pays.
ndiamond@watdaisy.UUCP (Norman Diamond) (01/28/85)
> In Pascal, it's perfectly reasonable to change the type of a variable or > the parameters of a procedure, fix what you can find, and let the compiler > find the rest. In C, there's a big chance that there will be errors that > the compiler won't catch. Unfortunately, this is a poor example. With very rare exceptions, user-defined type names should be declared in both languages, and used consistently in each set of procedures. Of course, when two kinds of variables do not really represent the same kind of object, but only happen to be expressible using isomorphic types, they should still have two distinct type-names. Now, when you want to change the type of a variable and related parameters, etc., you change the type definition in one place, and the program remains consistent. In either language. Of course, C didn't used to support this possibility until enough Pascal users discovered how powerful a tool it was. -- Norman Diamond UUCP: {decvax|utzoo|ihnp4|allegra|clyde}!watmath!watdaisy!ndiamond CSNET: ndiamond%watdaisy@waterloo.csnet ARPA: ndiamond%watdaisy%waterloo.csnet@csnet-relay.arpa "Opinions are those of the keyboard, and do not reflect on me or higher-ups."