[FONT=&]I am a total newbie to Free Pascal (2.4.4), using Win98. A longtime Turbo Pascal (4.0) user, I’m attempting to transfer my TP programs for use in FPC. I am wondering if there exists a general guide (TP>>FPC); a list of code differences that I need to know.[/FONT]
[FONT=&]For my very first program/unit, I performed an initial make-compile which generated a number of compiler messages (identifier not found, etc.). This demonstrates there are code differences, although I’m assuming they’re not extensive. I’m thinking if I could first address the broader/generic code differences, in a second-step I could then minimize/address the subsequent compiler messages.[/FONT]
[FONT=&]I could be over-reacting to this first compile. A possible remedy might be to address those messages in a singular systematic-way. In the broader sense, can anyone provide some helpful input here? Thank you.[/FONT]
5 replies to this topic
#1
Posted 27 January 2012 - 07:45 AM
|
|
|
#2
Posted 27 January 2012 - 09:18 AM
#3
Posted 27 January 2012 - 02:28 PM
[FONT="]Per my last paragraph, I am slugging it out with multiple compiles, correcting items as I go; not unlike typical programming work. This involves almost 1800 lines of code (program + unit), so it feels like my transition TP code is largely working within the FPC domain. I.e., progress is being made. For the present however, I am stopped by a particular compiler-message. The problem line of code is as follows:[/FONT]
[FONT="]FUNCTION Prob;[/FONT]
[FONT="] [/FONT]
[FONT="]It is the lead line of a function; the only function among many procedures within the unit. The message reads as follows:[/FONT]
[FONT="]Syntax error, “:” expected but “;” found[/FONT]
[FONT="] [/FONT]
[FONT="]A trailing semi-colon is the code convention I‘m familiar with here, so I’m baffled. When I replace it with a colon as requested, the compiler then says a semi-colon was expected (???). Is it possible that FPC doesn’t recognize functions, only procedures? Can anyone shine a light? Thank you.[/FONT]
[FONT="]FUNCTION Prob;[/FONT]
[FONT="] [/FONT]
[FONT="]It is the lead line of a function; the only function among many procedures within the unit. The message reads as follows:[/FONT]
[FONT="]Syntax error, “:” expected but “;” found[/FONT]
[FONT="] [/FONT]
[FONT="]A trailing semi-colon is the code convention I‘m familiar with here, so I’m baffled. When I replace it with a colon as requested, the compiler then says a semi-colon was expected (???). Is it possible that FPC doesn’t recognize functions, only procedures? Can anyone shine a light? Thank you.[/FONT]
#4
Posted 28 January 2012 - 06:45 PM
functions have to specify the return type. I'm guessing that's missing.
#5
Posted 28 January 2012 - 08:19 PM
[FONT="]Thanks to all for your input. As a result, I now have a clean compile. With 2700 lines of code over the main program and two supporting units, I’m over the hump; the door now open to some fruitful future output. Of course, that’s not to say I won’t be back on the forum with some future “inexplicable” stoppage. When/if I do, I know the support mechanism is here.[/FONT]
[FONT="] [/FONT]
[FONT="]As with any forum-derived remedy, the solution is a conglomeration of many varied pieces of advice. One typically digests all that is offered, learns from each, and crafts a rationale. In this case, there was no code difference between TP and FPC. They appear to be identical, as it should be. The essence of my problem, related to function syntax, was that my former TP4 compiler was a bit more lenient; it allowed a looser interpretation. In the end, the FPC compiler was textbook. It ran when the code finally conformed to proper syntax. Again, much thanks for your help.[/FONT]
[FONT="] [/FONT]
[FONT="]As with any forum-derived remedy, the solution is a conglomeration of many varied pieces of advice. One typically digests all that is offered, learns from each, and crafts a rationale. In this case, there was no code difference between TP and FPC. They appear to be identical, as it should be. The essence of my problem, related to function syntax, was that my former TP4 compiler was a bit more lenient; it allowed a looser interpretation. In the end, the FPC compiler was textbook. It ran when the code finally conformed to proper syntax. Again, much thanks for your help.[/FONT]
#6
Posted 28 January 2012 - 09:55 PM
I'm glad we could help :)
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









