storm@cs.mcgill.ca (Marc WANDSCHNEIDER) (05/11/91)
What is wrong with the following delcaration in my file sim.h:
typedef struct HP {
int last;
Eventtype items[MAXHEAP];
} Heaptype;
For some reason, this only works if I remove the MAXHEAP (which was #defined).
Why?
Also, in the main program (which has an #include "sim.h"), the following don't
work:
Queuetype Qu[MAXPROCS];
char G[MAXPROCS][MAXPROCS], R[MAXPROCS][MAXPROCS];
Queuetype and the others are typedef'd and #defined in sim.h.
The error I get with first line there is:
Array bounds missing ] in function main.
The second line just gives SYNTAX error.
Any ideas whad be happening?
./*-
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
storm@cs.mcgill.ca McGill University It's 11pm, do YOU
Marc Wandschneider Montreal, CANADA know what time it is?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
jeenglis@alcor.usc.edu (Joe English) (05/11/91)
storm@cs.mcgill.ca (Marc WANDSCHNEIDER) writes: > >What is wrong with the following delcaration in my file sim.h: > >typedef struct HP { > int last; > Eventtype items[MAXHEAP]; >} Heaptype; > >For some reason, this only works if I remove the MAXHEAP (which was #defined). >Why? That depends, of course, on what MAXHEAP was #defined *to*. You didn't include the definition in your post, but this: >Array bounds missing ] in function main. looks familiar... A mistake that I frequently make is to #define MAXTHING 256; instead of #define MAXTHING 256 /* Note: no semicolon here */ Remember that a macro definition consists of the entire line. You may be getting "Eventtype items[MAXHEAP;];", which is a syntax error. --jeenglis@alcor.usc.edu