Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2009-10

open arrays as parameters (why packed not allowed)?

7 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Bruce Bauman

I am translating some Pascal code from MetaWare Professional Pascal to Free Pascal.

The MetaWare code uses conformant arrays, which are not supported within Free Pascal. We are thus translating these to use Free Pascal open arrays.

However, Free Pascal does not allow the "packed" qualifier on the array parameter.

For example,

procedure PackStr         // Convert string to packed array
   (    InStr:      StdStrLong;
    var OutArr:     packed array of char);

is not allowed, while

procedure PackStr // Convert string to packed array

   (    InStr:      StdStrLong;
    var OutArr:     array of char);

is accepted by the compiler.

Is there a reason why "packed" is not allowed in this context?

Thanks.

-- Bruce

CONFIDENTIALITY NOTICE: This e-mail is confidential and intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please delete it from your computer and contact the sender.

Reply by email

Jonas Maebe
to Bruce Bauman

On 15 Oct 2009, at 14:49, Bruce Bauman wrote:

[packed for open array parameters]

Is there a reason why "packed" is not allowed in this context?

I think it's simply because I forgot to add it when adding support for packed arrays. Please file a bug report.

Jonas

Reply by email

Bruce Bauman
to Jonas Maebe

Thanks. Will do.

Earlier message 20 lines
-----Original Message----- From: On Behalf Of Jonas Maebe Sent: Thursday, October 15, 2009 10:28 AM To: FPC-Pascal users discussions Subject: Re: [fpc-pascal] open arrays as parameters (why packed not allowed)? On 15 Oct 2009, at 14:49, Bruce Bauman wrote: [packed for open array parameters] > Is there a reason why "packed" is not allowed in this context? I think it's simply because I forgot to add it when adding support for packed arrays. Please file a bug report. Jonas

Reply by email

Jonas Maebe
to Bruce Bauman
Bruce Bauman wrote 14 lines
From: On Behalf Of Jonas Maebe Sent: Thursday, October 15, 2009 10:28 AM On 15 Oct 2009, at 14:49, Bruce Bauman wrote: > [packed for open array parameters] >> Is there a reason why "packed" is not allowed in this context? > > I think it's simply because I forgot to add it when adding support > for > packed arrays. Please file a bug report. > Thanks. Will do.

Sorry, I misread the mail, I thought it was about bitpacked arrays. Plain "packed" arrays are no different from regular arrays in FPC (we basically ignore that modifier, except in MacPas mode where it's an alias for bitpacked), so the "packed" monicker can simply be left out when declaring the open array parameter.

Jonas

Reply by email

Jürgen Hestermann
to Jonas Maebe
Show quoted text 5 lines
Sorry, I misread the mail, I thought it was about bitpacked arrays. Plain "packed" arrays are no different from regular arrays in FPC (we basically ignore that modifier, except in MacPas mode where it's an alias for bitpacked), so the "packed" monicker can simply be left out when declaring the open array parameter.

Then it could also be allowed (and ignored)?

Reply by email

Jonas Maebe
to Jürgen Hestermann
Jürgen Hestermann wrote 7 lines
> Sorry, I misread the mail, I thought it was about bitpacked arrays. > Plain "packed" arrays are no different from regular arrays in FPC > (we basically ignore that modifier, except in MacPas mode where > it's an alias for bitpacked), so the "packed" monicker can simply > be left out when declaring the open array parameter. Then it could also be allowed (and ignored)?

Yes, but he doesn't have to wait for this to be implemented in the compiler.

Jonas

Reply by email

Bruce Bauman
to Jonas Maebe

Great, although ignoring the "packed" would be very useful as we are mechanically translating a large body of code.

-- Bruce

________________________________

Earlier message 33 lines
From: on behalf of Jonas Maebe Sent: Fri 10/16/2009 4:50 AM To: FPC-Pascal users discussions Subject: Re: [fpc-pascal] open arrays as parameters (why packed not allowed)? On 16 Oct 2009, at 10:43, Jürgen Hestermann wrote: >> Sorry, I misread the mail, I thought it was about bitpacked arrays. >> Plain "packed" arrays are no different from regular arrays in FPC >> (we basically ignore that modifier, except in MacPas mode where >> it's an alias for bitpacked), so the "packed" monicker can simply >> be left out when declaring the open array parameter. > > Then it could also be allowed (and ignored)? Yes, but he doesn't have to wait for this to be implemented in the compiler. Jonas_______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal CONFIDENTIALITY NOTICE: This e-mail is confidential and intended solely for the use of the individual or entity to which it is addressed. If you are not the intended recipient, be advised that you have received this email in error and that any use, dissemination, forwarding, printing or copying of this e-mail is strictly prohibited. If you received this e-mail in error, please delete it from your computer and contact the sender.

Reply by email