[fpc-pascal]Getting the size of an array
In Delphi (the later versions I suppose), it is possible to get the size of an array, and not just the size of a String, using Length() Is this not available yet in FreePascal or is there another way of doing it? You can use SizeOf, but then you'd have to get the SizeOf the type of the array first (is this possible?) and divide the SizeOf the array type by it. -- = reply-to: a n d y @ n e t f x p h . c o m http://www.neotitans.com Web and Software Development ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]No runtime range checking?
program blah; type stringy = array[4..10] of char; var C: stringy; D: array[2..5] of char; procedure showstring(I:Integer); begin Write(C[I]); end; begin C:='ABCDEFGHIJKLMNOPQRSTUVWXYZ'; D:='ABCDEFGHIJKLMNOPQRSTUVWXYZ'; Writeln(D); showstring(-5); end. FPC doesn't even complain about range exceeded whether during compilation or runtime... isn't this an egregious violation of Pascal's strict typing philosophy? Does Turbo Pascal/Delphi behave this way as well? ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Getting the size of an array
> In Delphi (the later versions I suppose), it is > possible to get the size of an array, and not just > the size of a String, using Length() > > Is this not available yet in FreePascal or is there > another way of doing it? > > You can use SizeOf, but then you'd have to get the > SizeOf the type of the array first (is this possible?) > and divide the SizeOf the array type by it. It is already supported in the development (1.1) compiler ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
RE: [fpc-pascal]No runtime range checking?
Did you turn it on when you compiled... default is off. J FPC doesn't even complain about range exceeded whether during compilation or runtime... isn't this an egregious violation of Pascal's strict typing philosophy? Does Turbo Pascal/Delphi behave this way as well? This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. LogicaCMG global sponsors, Gartner Symposium, Cannes, 4th -7th November 2003 http://symposium.gartner.com/story.php.id.3323.s.5.html Please note that LogicaCMG does not have control over content from,or availability of, this website ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]No runtime range checking?
Andy Sy wrote: program blah; type stringy = array[4..10] of char; var C: stringy; D: array[2..5] of char; procedure showstring(I:Integer); begin Write(C[I]); end; begin C:='ABCDEFGHIJKLMNOPQRSTUVWXYZ'; D:='ABCDEFGHIJKLMNOPQRSTUVWXYZ'; Writeln(D); showstring(-5); end. FPC doesn't even complain about range exceeded whether during compilation or runtime... isn't this an egregious violation of Pascal's strict typing philosophy? Does Turbo Pascal/Delphi behave this way as well? Ah... turns out there's -Cr... I guess one can consider it a debug on/off option. Very nifty. Just perfect. -- = reply-to: a n d y @ n e t f x p h . c o m http://www.neotitans.com Web and Software Development ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]No runtime range checking?
> FPC doesn't even complain about range exceeded whether > during compilation or runtime... isn't this an egregious > violation of Pascal's strict typing philosophy? Does > Turbo Pascal/Delphi behave this way as well? Or put -Cr in your fpc.cfg file ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]No runtime range checking?
On Thu, 2 Oct 2003, Andy Sy wrote: > program blah; > > type >stringy = array[4..10] of char; > > var >C: stringy; >D: array[2..5] of char; > > procedure showstring(I:Integer); > begin >Write(C[I]); > end; > > begin >C:='ABCDEFGHIJKLMNOPQRSTUVWXYZ'; >D:='ABCDEFGHIJKLMNOPQRSTUVWXYZ'; >Writeln(D); >showstring(-5); > end. > > > FPC doesn't even complain about range exceeded whether > during compilation or runtime... It does: malpertuus: ~ >ppc386 -Cr -gl testr.pp malpertuus: ~ >./testr ABCD Runtime error 201 at 0x0040DC03 0x0040DC03 SHOWSTRING, line 12 of testr.pp 0x0040DCA9 main, line 19 of testr.pp 0x0040D365 >isn't this an egregious > violation of Pascal's strict typing philosophy? Does > Turbo Pascal/Delphi behave this way as well? Delphi doesn't compile your program: malpertuus: ~ >dcc32 /CC -$$R+ -$$P+ -$$V+ testr.pp Borland Delphi Version 13.0 Copyright (c) 1983,99 Inprise Corporation E:\root\testr.pp(16) Error: Incompatible types: 'stringy' and 'String' E:\root\testr.pp(17) Error: Incompatible types: 'Array' and 'String' E:\root\testr.pp(20) Michael. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]An 'all debug options enabled' command line switch
Might be a good idea to be able to compact -Cr -Co -CR -Ct -Ci into a single switch? -Cdebug or something like that -- = reply-to: a n d y @ n e t f x p h . c o m http://www.neotitans.com Web and Software Development ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
RE: [fpc-pascal]No runtime range checking?
You might want to put -gl in there too, so if there is run time error it tells you where...J > FPC doesn't even complain about range exceeded whether > during compilation or runtime... isn't this an egregious > violation of Pascal's strict typing philosophy? Does > Turbo Pascal/Delphi behave this way as well? Or put -Cr in your fpc.cfg file ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you. LogicaCMG global sponsors, Gartner Symposium, Cannes, 4th -7th November 2003 http://symposium.gartner.com/story.php.id.3323.s.5.html Please note that LogicaCMG does not have control over content from,or availability of, this website ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]An 'all debug options enabled' command line switch
> Might be a good idea to be able to compact > > -Cr -Co -CR -Ct -Ci > > into a single switch? -Cdebug or something like > that -CRriot works ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]An 'all debug options enabled' command line switch
On Thu, 2 Oct 2003, Andy Sy wrote: > Might be a good idea to be able to compact > > -Cr -Co -CR -Ct -Ci > > into a single switch? -Cdebug or something like > that You can combine it like this: -CroRti Michael. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]No runtime range checking?
Lee, John wrote: You might want to put -gl in there too, so if there is run time error it tells you where...J Ah... how nice... FreePascal is s elegant and easy to use compared to C. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]Re: An 'all debug options enabled' command line switch
> Might be a good idea to be able to compact > > -Cr -Co -CR -Ct -Ci > > into a single switch? -Cdebug or something like > that Hmm... answering my own question... I guess -CritoR is easy enough to remember... it should work like -v, right? -- = reply-to: a n d y @ n e t f x p h . c o m http://www.neotitans.com Web and Software Development ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]No runtime range checking?
Michael Van Canneyt wrote: Delphi doesn't compile your program: malpertuus: ~ >dcc32 /CC -$$R+ -$$P+ -$$V+ testr.pp Borland Delphi Version 13.0 Copyright (c) 1983,99 Inprise Corporation E:\root\testr.pp(16) Error: Incompatible types: 'stringy' and 'String' E:\root\testr.pp(17) Error: Incompatible types: 'Array' and 'String' E:\root\testr.pp(20) I suppose this is because I'm assigning a larger string to an array[] of char that cannot hold it. Strange, even with runtime range checking on, fpc doesn't catch this problem. dcc apparently does as early as compile time... or am I missing something here? Also, will the writing outside of array bounds in lines 16 and 17 corrupt memory even with runtime range checking on? With RRC off, I'm almost sure it will, correct? ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]Fast answers in the mailing list
Woah... those answers sure are coming in fast! Am I on IRC? :-) ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Fast answers in the mailing list
> Woah... those answers sure are coming in fast! Am I on > IRC? :-) fpc irc is at irc.freenode.net : #fpc ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Fast answers in the mailing list
On Thu, Oct 02, 2003 at 07:50:15PM +0800, Andy Sy wrote: > Woah... those answers sure are coming in fast! Am I on > IRC? :-) When you have a good email client like 'mutt' and are online a lot of the day, you can expect replies in (almost) real-time :) hehe cheers James -- - -Zero Defect Software Engineers Group - ZDSEG - -You need only two tools. WD-40 and duct tape. -If it doesn't move and it should, use WD-40. -If it moves and shouldn't, use the tape. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]switch suboption usage
fpc accepts -glc, but will it work? Or does one need to do -gl -gc? For the help screen, what does the after the switch invocation actually mean? You have multiple -g, -a, -s and -i suboptions, but they are not indicated as -g, -a, -s and -i. Also, how does one figure out from the help screen when bunching together suboptions (i.e. -CritoR) will work and when they won't? ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal