Path: utzoo!utgpu!water!watmath!clyde!rutgers!rochester!cornell!uw-beaver!uw-june!pardo From: pardo@uw-june.UUCP (David Keppel) Newsgroups: comp.lang.c Subject: Runtime C checks (WAS: Possible extension to C) Summary: Is this legal? Keywords: Yukko! Message-ID: <3979@uw-june.UUCP> Date: 12 Jan 88 23:19:19 GMT References: <3306@ihlpf.ATT.COM> <525@gtx.com> Reply-To: pardo@uw-june.UUCP (David Keppel) Organization: U of Washington, Computer Science, Seattle Lines: 25 I've heard that there is a very good C compiler with runtime debug capabilites running on the MacIntosh, but I've only heard this once and wonder whether the source had it confused with Pascal for the Mac. There is at least one time when array subscripting checks might break legal C code -- I won't swear to this, but this is how it was told to me: typedef /* some arbitrary type */ a_type; typedef struct { int other_stuff; a_type a[1]; /* must be 1, not 0 */ } bork_t; bork_t *x = (bork_t *) malloc(sizeof(bork_t) + (n-1)* sizeof(a_type)); foo (x->other_stuff, x->a[n-1]); Allegedly, x is a pointer to a structure containing an int and an array of "n" a_type things; further (although x->a is defined to be a one-element array) the reference x->a[n-1] is _purported_ to be _legal_, _portable_ C. If you have evidence to the contrary, please tell me & I'll post a summary. ;-D on (Ugly? How about "switch(*x+++++*y){}"?) Pardo pardo@cs.washington.edu ucbvax!uw-beaver!uw-june!pardo