visitor (0 QPoints)
  • FR
  • EN
  • NL
  • DE
  • ES
315 experts, 1193 registered users, 1659 questions already answered
European Experts Exchange, the very best site for high-quality IT solutions

New Improved Search!

 


05/10/2011 1h30 : Steve Jobs is dead, the father of Apple ][ is gone, we are all orphaned.

Languages :: Pascal :: re: set definition


By: BobC Australia  Date: 19/06/2007 04:23:44  English  Points: 20 Status: Answered
Quality : Excellent
This is very fundamental, but I seem to be stumped.

I am using Free Pascal.

**** my errant code ********************
const
b_least = 000;
b_mostt = 255;

type
_b_all_rt = b_least..b_mostt;
b_all_bst = set of _b_all_rt;
const
b_all_bs : b_all_bst= [_b_all_rt];
**************************************************

My object is to create the constant "b_all_bs" based on all the types I have created. (in other words, eg. not to repeatedly type "255")
I know that I can write "b_all_bs : b_all_bst= [000..255];".
But if I change "b_least" this does not ripple through to "b_all_bs"
I expect that I do not understand the TYPEs as I should.

By: VGR Date: 19/06/2007 17:52:41 English  Type : Answer
in fact, the Pascal compiler shouldn't let you write this line :

const b_all_bs : b_all_bst= [_b_all_rt];



it is wrong. _b_all_rt is a type, not a valid scalar constant range ; you must have constants in the type definition.

In my humble opinion, this compiles and is the same :

const b_least = 000; b_mostt = 255; type _b_all_rt = b_least..b_mostt; b_all_bst = set of _b_all_rt; const b_all_bs : b_all_bst= [b_least..b_mostt];



I hope that this solves your problem.

Best regards
By: VGR Date: 05/07/2007 16:06:13 English  Type : Comment
is that ok now ? If yes, don't wait until the admins ask you to close the question ;-) do it :D
By: OpConsole Date: 01/11/2007 16:13:40 English  Type : Comment
Dear,

If you found some of the above comments to have proved helpful in solving your issue, you shall Accept the Answer or sPlit points between the various useful comments. Each one can receive a quality evaluation from + (somewhat helpful) to +++ (working solution).

Given this Question has been Open for quite a while now, please accordingly "accept an Answer" ASAP

This Question will be randomely force-closed in one month from now.

Thanks and regards.

Admin.

Do register to be able to answer

EContact
browser fav
page generated in 297.047850 milliseconds

Why Google AdSense ads ?

compteur
 Ranking-Hits PageRank for this page