[comp.windows.ms.programmer] TPW vs. C

dmurdoch@watstat.waterloo.edu (Duncan Murdoch) (05/17/91)

In article <1991May17.002102.14533@mnemosyne.cs.du.edu> ebergman@isis.UUCP (Eric Bergman-Terrell) writes:
>
>General question:  How is programming Windows in T. Pascal?  What's easier
>than using C?  What's more difficult?  How do you get statically bound
>variables?

I find what I'm trying to do now is probably pretty similar to doing the
same thing in C.  I'm forced to use the same Windows API calls; the syntax
is a little simpler, because Pascal can distinguish between passing by
reference and by value, but that's hardly significant.

One advantage to doing this in TP is that the compiler/editor runs as a 
Windows app, and is very fast.  I can make a change, hit Ctrl-F9 to compile
and run it, and try it out a few seconds later.  There's also the context
sensitive help screens:  the syntax and a (very) short description of all
the documented API calls are available from within the editor by pointing
and clicking on the name.

I haven't written one yet, but I suspect the real advantage to TP is going
to be in writing small Windows apps.  Borland supplies an OOP library that
you'd use instead of going directly to the API; it saves a lot of overhead
coding.  On a big application, you'd probably end up overriding most of the
defaults and writing just as much anyways; I don't know if the 
organization forced by the Borland library would be a help or a hindrance
there.

One really nice thing about the library is that it handles the message
loop and the window procedure completely.  You specify which messages
you're interested in by an index on the procedure when you declare it,
and the library will automatically call your procedure when appropriate.

As to what's more difficult:  I don't really know.  I haven't ever written
a serious C program, so I just don't know what I'm missing. 

As to statically bound variables:  what are those?  Do you mean variables
local to a procedure that maintain their value between calls?  If so,
you can get them by using initialized variables (misnamed "typed constants").
This is just the same as outside of Windows.  

Duncan Murdoch
dmurdoch@watstat.waterloo.edu