Re: Array subscripts with expressions
Posted in 1997
I, Jacob Salomon wrote: > > Hi folks, > > I need to do some array operations and don't like to create extra > variables to maintain a lot. Here is a record variable; te purpose is > probably obvious but irrelevant to the problem at hand: > > define win_stack record > win_stack_size smallint, # Number of elements in stack > top_win_num smallint, # Pointer to window atop stack > win_name array[200] of char(10) # Array of window names > end record > > Now, later in the code I want to reference the "top" element on the > stack, so I use the top_win_num as the array subscript. Since it is a > member of a record variable, I need to use the complete qualification: > > let win_stack.win_name[win_stack.top_win_num] = cur_win_name > > The compiler objects to this, with the following 2 error messages. --- SNIP --- > I obviously have a workaround - use that stupid simple variable. > > Any cleaner ways? Does anyone else share that memory or was it wishful > thinking on my part? Jonathan answered me by e-mail. Yes, my memory was engaging in wishful thinking. The syntax I want to use, while honorable of intention and quite valid in C, never worked in 4GL. Sad, but true and certainly not critical. I posted this for the benefit of the also curious. Thanks much, Jonathan. -- -- Jake (Lost in thought and won't ask for directions) . . _..-'( )`-.._ ./'. '||\\\\. }\\_/{ .//||` .`\\. ./'.|'.'||||\\\\|.. )o o( ..|//||||`.`|.`\\. ./'..|'.|| |||||\\`````` \\,@,/ ''''''/||||| ||.`|..`\\. ./'.||'.|||| ||||||||||||. ||| .|||||||||||| ||||.`||.`\\. /'|||'.|||||| ||||||||||||{ | }|||||||||||| ||||||.`|||`\\ '.|||'.||||||| ||||||||||||{ | }|||||||||||| |||||||.`|||.` '.||| ||||||||| |/' ``\\||`` | ''||/'' `\\| ||||||||| |||.` |/' \\./' `\\./ \\!|\\ /|!/ \\./' `\\./ `\\| V V V }' `\\ /' `{ V V V \\ \\ \\ V / / / +-----------------------------------------------------------+ | Impeccable Logic: A thought process which successfully | | resists chicken bites | +-----------------------------------------------------------+