Recent

Author Topic: free pascal questions  (Read 2779 times)

ryuo

  • Newbie
  • Posts: 1
free pascal questions
« on: February 23, 2015, 06:04:35 pm »
I have used C for ~6 years now and I have recently been evaluating the technical merits of Free Pascal for usage on small projects. There are some things I am still unable to find answers for. Mainly it involves what debugging and safety options the units shipped with the compiler have been compiled with as they are distributed in binary form with the compiler.

1) Are the units compiled with any debugging information?
2) Are the units compiled with any input/output, range, overflow, or stack checking code?
3) If the answer is no to these, then is it possible to recompile the units with these options turned on?
4) Are Free Pascal integer and floating point types always the same size for all supported platforms? The only exceptions I've seen suggesting otherwise is 'integer' and 'real'.

Thank you.

CM630

  • Hero Member
  • *****
  • Posts: 858
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: free pascal questions
« Reply #1 on: February 23, 2015, 06:31:37 pm »
1) Are the units compiled with any debugging information?
Yes
2) Are the units compiled with any input/output, range, overflow, or stack checking code?
Yes, if the following items are checked in the IDE main menu -> Project -> Project Options -> Compiler Options -> Debugging -> -Ci, -Cr, -Co, -St, -Cr, -Sa.
4) Are Free Pascal integer and floating point types always the same size for all supported platforms? The only exceptions I've seen suggesting otherwise is 'integer' and 'real'.
Check here: http://wiki.freepascal.org/Pascal_for_C_users
Лазар 1,8,2;W7 64bit or XP 32bit;FPC3,0,4;rev 57369

howardpc

  • Hero Member
  • *****
  • Posts: 3177
Re: free pascal questions
« Reply #2 on: February 23, 2015, 06:48:20 pm »
Mainly it involves what debugging and safety options the units shipped with the compiler have been compiled with as they are distributed in binary form with the compiler.

1) Are the units compiled with any debugging information?

If we are talking about a release version of Lazarus, then the answer is Yes and No. The LCL units are compiled with debug information, so you can step through LCL code (as well as your own code, if you have enabled debugging information). However, the FreePascal .ppus for the RTL do not come with debug info (at least, not the ones packaged with Lazarus). So if you want to step through RTL code you would have to recompile FPC yourself with the appropriate options, and then set the IDE compiler paths to use your newly compiled (bulky) RTL units.
« Last Edit: February 23, 2015, 06:50:33 pm by howardpc »

marcov

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 7497
Re: free pascal questions
« Reply #3 on: February 23, 2015, 07:51:41 pm »
Note that turning debugging on in the system or sysutils unit is very annoying in practice. You really don't want to trace into a routine for every operation on an automated type (like a string).

That's mostly only useful if you are really searching for bugs in those units.