Languages :: Pascal :: re: set definition |
|||
| By: BobC |
Date: 19/06/2007 04:23:44 |
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 | 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 | 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 | 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 |
|||
©2010 These pages are served without commercial sponsorship. (No popup ads, etc...). Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE.
Please DO link to this page!








