Xref: utzoo comp.lang.c:25841 comp.lang.pascal:3078 comp.lang.misc:4082 Path: utzoo!attcan!uunet!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!sol.ctr.columbia.edu!cica!iuvax!maytag!watstat!dmurdoch From: dmurdoch@watstat.waterloo.edu (Duncan Murdoch) Newsgroups: comp.lang.c,comp.lang.pascal,comp.lang.misc Subject: Re: C to Pascal Conversion (Was: Pascal to C Conversion) Message-ID: <1489@maytag.waterloo.edu> Date: 11 Feb 90 18:40:59 GMT References: <52037@XAIT.Xerox.COM> <1990Feb2.172112.4509@cunixf.cc.columbia.edu> <3576@garth.UUCP> <4007@cbnewsl.ATT.COM> <13785@cit-vax.Caltech.Edu> <6263@ncar.ucar.edu> <1990Feb10.231432.27149@utzoo.uucp> Sender: daemon@maytag.waterloo.edu Reply-To: dmurdoch@watstat.waterloo.edu (Duncan Murdoch) Organization: U. of Waterloo, Ontario Lines: 25 In article <1990Feb10.231432.27149@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes: >In article <6263@ncar.ucar.edu> hpoppe@bierstadt.scd.ucar.edu (Herb Poppe) writes: >>How about the flip side of the coin? Does anyone know of C to Pascal >>translators? > >I'd be very surprised to hear of any, since most C programs cannot be >translated into Pascal in any simple way. C's pointers, in particular, >are far more powerful than Pascal's and there is no easy way to fake them. Do you think so? Perhaps you're talking about standard Pascal; Turbo Pascal lets pointers be used almost as loosely as C does. Certainly there's no built in operator to increment one, but it would be very easy to write one: inc(longint(rec_ptr),sizeof(rec)); would come close if you didn't need to worry about crossing segment boundaries. A bigger problem would be the growth in a program if it were translated. Assignments must all be done in separate statements in Pascal (unless you define an assignment function), and Turbo Pascal doesn't support macros the way C does, so they'd all have to be expanded before translation. Of course, the biggest problem of all would be that the Pascal program would end up just as unreadable as the C program it was translated from - even Pascal can't make an ugly program pretty. Duncan Murdoch