Article View: comp.std.c
Article #1255Re: struct hack, was Re: strcpy implementation question
From: 04-Sep-1992 1639
Date: Fri, 04 Sep 1992 07:41
Date: Fri, 04 Sep 1992 07:41
23 lines
1730 bytes
1730 bytes
In article <1992Sep4.015335.3612@thinkage.on.ca> dat@thinkage.on.ca (David Adrien Tanguay) writes: >diamond@jit081.enet.dec.com (03-Sep-1992 1325) writes: >>In article <PINKAS.92Sep2173635@skywalker.intel.com> pinkas@skywalker.intel.com (Israel Pinkas) writes: >>>The variable length struct is a hack. There is nothing in the language that >>>prevents the compiler from performing bounds checking on accesses to name. >>Uh, nothing except the standard's definitions of [], unary *, and binary + >>operators. :-R rhetoric. >>Bounds checking is not allowed to affect output of a valid but ugly program. >I had the impression that the last time it came up here the conclusion was >that this trick was not sanctioned[...] 3.3.6 "Additive Operators" >says that you aren't guaranteed to go past the end of an array object, No (though it was the conclusion of some others) and yes, respectively. You can't go past the end of an array object. But if malloc() or some other variable has defined the end of the actual array object, then the + operator can get you that far, regardless of the declared type that some other array variable had before getting flattened to a pointer. -- Norman Diamond diamond@jit081.enet.dec.com If this were the company's opinion, I wouldn't be allowed to post it. "Yeah -- bad wiring. That was probably it. Very bad."
Technical Details
Message-ID:
<9209040741.AA16120@enet-gw.pa.dec.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!sdd.hp.com!hplabs!ucbvax!jit081.enet.dec.com!diamondShow Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sdd.hp.com!hplabs!ucbvax!jit081.enet.dec.com!diamond From: diamond@jit081.enet.dec.com (04-Sep-1992 1639) Newsgroups: comp.std.c Subject: Re: struct hack, was Re: strcpy implementation question Message-ID: <9209040741.AA16120@enet-gw.pa.dec.com> Date: 4 Sep 92 07:41:41 GMT Sender: daemon@ucbvax.BERKELEY.EDU Lines: 23