Mombu the Programming Forum sponsored links

Go Back   Mombu the Programming Forum > Programming > Programming languages > Packed record fields
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 19th October 02:01
waldek hebisch
External User
 
Posts: 1
Default Packed record fields



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?

--
Waldek Hebisch
hebisch@math.uni.wroc.pl
  Reply With Quote


  sponsored links


2 19th October 02:01
scott moore
External User
 
Posts: 1
Default Packed record fields



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.
  Reply With Quote
3 27th October 08:17
scott moore
External User
 
Posts: 1
Default Packed record fields


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.
  Reply With Quote
4 14th March 03:27
scott moore
External User
 
Posts: 1
Default Packed record fields


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.
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666