[fpc-pascal]Two simple dynamic arrays questions
Hi, I am new to dynamic/open arrays. I've installed 1.9.4 and played with the example code, read the docs, and converted a sample program that I'd written using static arrays to dynamic. I have two residual questions: (1) Previously, I had fillchar'd the static arrays with zeros because they are sparse-ish. Looks like dynamic arrays are automagically filled with zeros. Is this true/permanent? Or a lucky coincidence that I shouldn't count upon? If the later, is there a fast one-liner like fillchar that I can use to initalize array to zeros? (2) There is no way, I supposed, to switch the array indexes to start at 1 is there? I ask not from intrasigence but because I am using matricies and it rains on my elegance parade to have to perform the trivial translation each time I want to access an element using absolute row/column addresses. I also have a lot of older code and I'll have to hunt through it and make this change everywhere... Thanks! -Alan ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]Help! /usr/bin/ld: cannot find -lc
I can't figure out how to fix this error when compiling [linux - RH8]: /usr/bin/ld: cannot find -lc Any help greatly appreciated! ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Help! /usr/bin/ld: cannot find -lc
On 28 jul 2004, at 23:15, Jeff Weeks wrote: I can't figure out how to fix this error when compiling [linux - RH8]: /usr/bin/ld: cannot find -lc Install the (C-)development libraries (libc-dev or something like that) for your system using your favorite package manager. Jonas ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Two simple dynamic arrays questions
On 28 jul 2004, at 19:48, Alan Mead wrote: (1) Previously, I had fillchar'd the static arrays with zeros because they are sparse-ish. Looks like dynamic arrays are automagically filled with zeros. Is this true/permanent? Yes. (2) There is no way, I supposed, to switch the array indexes to start at 1 is there? No, there is unfortunately no way to do this. Jonas ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Re: [fpc-pascal]Two simple dynamic arrays questions
At 19:48 28/07/2004, you wrote: (2) There is no way, I supposed, to switch the array indexes to start at 1 is there? I ask not from intrasigence but because I am using matricies and it rains on my elegance parade to have to perform the trivial translation each time I want to access an element using absolute row/column addresses. I also have a lot of older code and I'll have to hunt through it and make this change everywhere... Just fill the [0] position with 0 or any other value and ignore it, begining using at [1]. Thanks! ** This document represent my ideas. They are original from me. It's forbidden think the same than me, without previous payment. If you agree me, PAY. If you don't do so, you are infringing the copyrigth laws. If you divulge my ideas in any media, you will be hunt, skin and cook. ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
RE: [fpc-pascal]Two simple dynamic arrays questions
Would not allocating the dynamic arrays a single element greater in size not permit you to address their elements the way you'd like. I.e.: for a five element array, allocate size 6 and get [0..5] and then use only [1..5]? Just pretend that the [0] position doesn't exist. Of Course, you'd have to be careful with low(x) as the index starting spot. If this is too easy what am I missing? Stu -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Jonas Maebe Sent: Wednesday, July 28, 2004 12:00 PM To: [EMAIL PROTECTED] Subject: Re: [fpc-pascal]Two simple dynamic arrays questions On 28 jul 2004, at 19:48, Alan Mead wrote: > (1) Previously, I had fillchar'd the static arrays with zeros because > they are sparse-ish. Looks like dynamic arrays are automagically > filled with zeros. Is this true/permanent? Yes. > (2) There is no way, I supposed, to switch the array indexes to start > at 1 is there? No, there is unfortunately no way to do this. Jonas ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]Extension of macros exceeds a depth of 16
As a I mentined earlier today in a different thread, I have upgraded to 1.9.4 and I appreciate the greater checking. Most of the new warnings I get are clear but one of my units now reports "Extension of macros exceeds a depth of 16". What does this warning mean and what is the rammification of ignoring it? The line number where it reports the warning is an {$if def ...} and I would assume the warning had something to do with nesting compiler conditionals... but that's not the case (unless the parser is really getting lost... but since the code operates, I cannot imagne that this is happening..). This conditional should be at the "top level"--it is not nested under anything. -Alan ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
RE: [fpc-pascal]Two simple dynamic arrays questions
Yes, this is a good idea. I think it thwarts length() and low() but since I'm using two dimensional arrays, these aren't helpful... I'm not a fluent OOP programmer, but I'm already using a record to record the real rows and columns, matrix name, etc. so I think I'm going to wrap these open arrays in an object so that I can supply replacements for these and other methods and it would be easy to hide this wrinkle inside the object. -Alan --- "Cox, Stuart TRAN:EX" <[EMAIL PROTECTED]> wrote: > Would not allocating the dynamic arrays a single element greater in > size not > permit you to address their elements the way you'd like. > I.e.: for a five element array, allocate size 6 and get [0..5] and > then use > only [1..5]? Just pretend that the [0] position doesn't exist. > Of Course, you'd have to be careful with low(x) as the index > starting spot. > If this is too easy what am I missing? > > Stu > > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Jonas > Maebe > Sent: Wednesday, July 28, 2004 12:00 PM > To: [EMAIL PROTECTED] > Subject: Re: [fpc-pascal]Two simple dynamic arrays questions > > > > On 28 jul 2004, at 19:48, Alan Mead wrote: > > > (1) Previously, I had fillchar'd the static arrays with zeros > because > > they are sparse-ish. Looks like dynamic arrays are automagically > > > filled with zeros. Is this true/permanent? > > Yes. > > > (2) There is no way, I supposed, to switch the array indexes to > start > > at 1 is there? > > No, there is unfortunately no way to do this. > > > Jonas > > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > > ___ > fpc-pascal maillist - [EMAIL PROTECTED] > http://lists.freepascal.org/mailman/listinfo/fpc-pascal > ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]force ansistrings to be copied on duplication
Hi, according to the manual AnsiStrings are 'copied on change'. Can the compiler be forced to copy on duplication? --- like this --- var s1:PChar='something'; s2:PChar; begin s2 := s1; if (s1 <> s2) then writeln('Okay') else writeln(':-( only a doubled pointer'); end; --- As an alternative I think I would have to use StrNew/StrDispose and do some pointer collection. That would be too much effort in my case... TIA, Marc ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal
[fpc-pascal]Re: force ansistrings to be copied on duplication
Hi again, Am Do, den 29.07.2004 schrieb Marc Santhoff um 06:33: > --- like this --- > var > s1:PChar='something'; this should be s1:AnsiString='something'; of course ... > s2:PChar; > > begin > s2 := s1; > if (s1 <> s2) then > writeln('Okay') > else > writeln(':-( only a doubled pointer'); > > end; > > --- Sorry, Marc ___ fpc-pascal maillist - [EMAIL PROTECTED] http://lists.freepascal.org/mailman/listinfo/fpc-pascal