Article View: comp.dsp
Article #2331Re: C code .vs. Assembly code for Microcontrollers/DSPs ?
From: Steve Rencontre
Date: Thu, 28 Mar 1996 16:59
Date: Thu, 28 Mar 1996 16:59
28 lines
1744 bytes
1744 bytes
In article: <4j9lfh$o2l@narses.hrz.tu-chemnitz.de> hfst@hrz.tu-chemnitz.de (Hans Steffani) writes: > Steve Rencontre <Steve@dstrip.demon.co.uk> writes: > > >Oh yes it can! > > > ... > > int var1, var2; > > int *var1p = &var1; > > var1p[-1] = 0; > > ... > > Post this to comp.lang.c[.moderated] and you will be told that this > leads to undefined behavior and something like that. Well my newsreader doesn't know how to post to moderated groups, and I'm too lazy to do it by hand :-), but anyway... It may be undefined by the *language*, but then so is the size of an int! However, this very behaviour is relied on by stdargs/varargs in order to make variable parameter lists possible. Yes, it's implementation-dependent -- but that doesn't mean it results in unpredictable or unreliable behaviour within that implementation. ----------------------------------------------------------------------- Steve Rencontre | steve@dstrip.demon.co.uk (business) If it works, it's obsolete. | steveren@cix.compulink.co.uk (private) -----------------------------------------------------------------------
Technical Details
Message-ID:
<436922997wnr@dstrip.demon.co.uk>Path:
arc1-ca.pugleaf.net!mail2news.demon.co.uk!dstrip.demon.co.ukReferences:
<620174950wnr@dstrip.demon.co.uk> <4j9lfh$o2l@narses.hrz.tu-chemnitz.de>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!mail2news.demon.co.uk!dstrip.demon.co.uk From: Steve Rencontre <Steve@dstrip.demon.co.uk> Newsgroups: comp.dsp,comp.lang.c Subject: Re: C code .vs. Assembly code for Microcontrollers/DSPs ? Date: Thu, 28 Mar 1996 16:59:26 Organization: Datastrip Limited Message-ID: <436922997wnr@dstrip.demon.co.uk> References: <620174950wnr@dstrip.demon.co.uk> <4j9lfh$o2l@narses.hrz.tu-chemnitz.de> Reply-To: Steve@dstrip.demon.co.uk X-NNTP-Posting-Host: dstrip.demon.co.uk X-Newsreader: Newswin Alpha 0.9 X-Mail2News-Path: relay-4.mail.demon.net!post.demon.co.uk!dstrip.demon.co.uk