Talk About Network



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 Misc > Using a variabl...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 6 Topic 709 of 792
Post > Topic >>

Using a variable within a record

by Dennis-Bendert Schramm <dennisschramm@[EMAIL PROTECTED] > Jan 18, 2007 at 01:48 AM

Hi,

how can I get the following piece of code to work:


type MenuRec=RECORD
         word_menuItem:word;
         word_itemNumber:word;
         p_itemArray:array[1..word_itemNumber]of pchar; {<- error occurs 
here! }
END;


I guess, you will understand what I want to do: I'd like to use a value 
stored in word_itemNumber for defining the size of an array within the 
very same Record.

But it won't compile, I get the following error message:


Free Pascal Compiler version 2.1.1 [2007/01/05] for i386
Copyright (c) 1993-2006 by Florian Klaempfl
Target OS: Darwin for i386
Compiling testprog.pas
dataworx.pas(23,45) Error: Identifier not found "word_itemNumber"
dataworx.pas(23,45) Error: Can't evaluate constant expression
dataworx.pas(23,54) Error: Data element too large
dataworx.pas(239,4) Fatal: There were 3 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/local/bin/ppc386 returned an error exitcode (normal if you 
did not specify a source file to be compiled)


How to solve this problem?

Thanks in advance,

Dennis Schramm




 6 Posts in Topic:
Using a variable within a record
Dennis-Bendert Schramm &l  2007-01-18 01:48:14 
Re: Using a variable within a record
Alan <alan@[EMAIL PROT  2007-01-18 02:00:09 
Re: Using a variable within a record
Wolf Behrenhoff <NoSpa  2007-01-18 02:21:49 
Re: Using a variable within a record
Dennis-Bendert Schramm &l  2007-01-18 06:59:10 
Re: Using a variable within a record
Waldek Hebisch <hebisc  2007-01-19 10:39:54 
Re: Using a variable within a record
"JP2R" <jp-d  2007-01-19 04:35:29 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Wed May 14 22:35:09 CDT 2008.