From: "A.Appleyard" Organization: Materials Science Centre To: DJGPP AT DELORIE DOT COM Date: Thu, 19 Sep 1996 09:04:06 GMT Subject: array-bound-checking Message-ID: <17B73660C60@fs2.mt.umist.ac.uk> (1) Thankyou for the various helpful replies to my recent admittedly very off-topic query about Windows programming; I am sorry if I annoyed anyone. (2) One thing that I miss in C is optional array-bound-checking like I found so useful in Algol-like languages and even in primitive `autocodes' for mainframes long before there were desktop computers; that facility quickly and easily spotted many out-of-bounds store accesses that in C programs are often the devil's own job to track down. Is putting an array bound in these C or C++ constructions forbidden, or is it allowed but ignored?:- int zxcvbnm(int n,double x[n]) { ...... } double *x[n+2]; If it is allowed, it would provide a way to specify size of parametric and pointed-to arrays for a possible array-bound-check compiler option. (3) It would be useful to have a pragma to tell the compiler to loop-unroll if possible one particular for or while loop instead of wasting compile time testing if every such loop in the program is unrollable. E.g.:- inline double pow(double x,int n){int i; double y; if(n<0) {x=1/x; n=-n;} y=1; while/*#unroll*/(n) {if(n&1) y*=x; x=x*x; n>>=1;} return y;} and e.g. `z=pow(x,4);' would expand and reduce to `EAX=x*x; z=EAX*EAX;'.