Re: [CODE] [HELP/REQUEST] 128 bit code

From: Jason Wilkins (fenix@IO.COM)
Date: 10/01/98


Scott Clifford wrote:

> comm.c: In function `prompt_str':
> comm.c:964: subscripted value is neither array nor pointer
> comm.c:1025: subscripted value is neither array nor pointer

This happens when you do something like

float blah;

blah[10];


> the corresponding lines are as follows
>
> comm.c:964  color = (PRF_FLAGGED(ch, PRF_COLOR_1 || PRF_COLOR_2) ? 1 : 0);

is this supposed to be a ||, and not a |
the definition of PRF_COLOR_1 and PRF_COLOR_2 is 13 and 14, so
the value of PRF_COLOR_1 || PRF_COLOR_2 would be 1.

I think you may be looking for 13|14 = 15, although its a bug, its got
nothing to do with the compiler error you're finding.

> comm.c:1025 sprintf(i, "%s &X(&r%d&X)&w", PERS(vict, ch),
>
> and the defines are as follows
>
> #define PRF_COLOR_1     13 /* Color (low bit)                   */
> #define PRF_COLOR_2     14 /* Color (high bit)                  */
>                     ^I have tried spaces and a tab here

Your compiler shouldn't care what type of whitespace you use, as long
as you don't put newlines inside constants.

> #define PERS(ch, vict)   (CAN_SEE(vict, ch) ? GET_NAME(ch) : "someone")

I think that this may be a problem somewhere else, since I don't see a single
subscript or [x] in any of this code.  Apparently you are using an argument
for one of these macros that is not an array or pointer, but is used as an
array when
the macro is expanded.

While recreating this compiler error, I tried the code

printf[13]

To my surprise it worked with no warning or error. It turns out that 'printf'
without () is a pointer (duh!).

I rewrote it:

printf()[13]

Low and behold I got the error "subscripted value is neither pointer nor
array"

Look at the macros you are using and make sure you are using the correct
types.

--
           Phoenix -- President of The Artistic Intuition Company
       Caelius * Mirror Reflex * Runica * X-Domain * Infinite Realms
                          http://www.io.com/~fenix


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/15/00 PST