Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Pascal Ansi -iso > Re: Packed reco...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 2 Topic 177 of 215
Post > Topic >>

Re: Packed record fields

by scott moore <nospam@[EMAIL PROTECTED] > Feb 1, 2006 at 01:32 AM

Waldek Hebisch wrote:
> Look at the following program:
> 
> program pack2;
> type pr = packed record r: record j : integer end end;
> var v : pr;
> procedure foo(var i : integer);
> begin
> end;
> begin
>   foo(v.r.j);
> end
> .
> 
> I think this program _should_ be illegal (otherwise possibilities
> to pack pr would be quite limited), but I can not find full
justification
> based on ISO 7185 or ISO 10206. Namely, 6.6.3.3 (in ISO 7185) and
> 6.7.3.3 (in ISO 10206) tells us that components of packed records
> should not be passed as var parameters. But "j" is a component of "r",
> which is not a packed record. The question is if "j" is a
> component of "v"? I was not able to find any definition of
> component in the standards, but it seems that in the standards
> component means what could be otherwise called "direct component".
> If "j" is not a component of "v", then AFAICS the program above
> is legal...
> 
> Any comments?
> 

I compiled it as:

PC compiler shell vs. 1.12.00 Copyright (C) 2005 S. A. Moore
Reading instruction file c:\ip\windows\i80386\bin\pc.ins
Building C:\TEST\test

Pascal parser vs. 1.12.01 Copyright (C) 2005 S. A. Moore
Processing: C:\TEST\test.pas
*** C:\TEST\test.pas [6:5] Symbol 'i' defined but never referenced ***
   foo(v.r.j);
         ^
*** C:\TEST\test.pas [8:9] Packed component cannot appear as variable 
parameter
***
Errors this compilation: 2
No output file was generated
Function complete
Build has errors, terminating

Sooo, basically IP considers any element of a packed, however deeply
nested to be subject to that restriction. I think that rule is
intuitive.

I suspect the 6.6.3.3 limitation key is if by "components" of a record
that also includes components of components of components.. etc.

I'll see if I can't find a concrete quotation in 7185 for ya tomorrow.
 




 2 Posts in Topic:
Packed record fields
Waldek Hebisch <hebisc  2006-01-31 22:48:19 
Re: Packed record fields
scott moore <nospam@[E  2006-02-01 01:32:47 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 26 5:39:45 CDT 2008.