Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail NNTP-Posting-Date: Sat, 02 Jun 2012 07:03:54 -0500 Message-ID: <4FCA0128.435E@mindspring.com> Date: Sat, 02 Jun 2012 08:03:52 -0400 From: pete Reply-To: pfiland@mindspring.com Organization: PF X-Mailer: Mozilla 3.04Gold (WinNT; I) MIME-Version: 1.0 Newsgroups: comp.lang.c Subject: Re: Q: Local variables initialization shortcut. References: <5835baa1-db3f-4b81-a9e9-3ea20a632ba8@w24g2000vby.googlegroups.com> <4f89a691-f680-4dbc-bdbc-363450ccc001@b26g2000vbt.googlegroups.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Lines: 29 X-Usenet-Provider: http://www.giganews.com NNTP-Posting-Host: 4.154.222.79 X-Trace: sv3-YJSrcyEddPUFdr4KMNQIqXvrv/l8Si+cf58RyL6J3lrGpQPAf07Kd7qCzCU0vik+PqIT/cmjmTAPbe5!vK3D2lLMU8cqpt7gTxh7YyEaXKDPX8MnJ93EhmRWYpT3G35icrSLz6vT6Epg/J54l2iPq1esWLSf!McKNtzJeIw== X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.40 X-Original-Bytes: 1965 Xref: csiph.com comp.lang.c:21664 Jean-Christophe wrote: > > On 2 juin, 12:31, j...@toerring.de : > > '&z - &a' isn't legal - you can only subtract addresses > > of locations within a single object (e.g. an array), > > I've done it many times and it always worked fine : If you beieve that something which works once, will always work again, then why ask questions instead of just testing your code? > &a is the address of 'a' so it's its memory location. The C standard characterizes that operation as being undefined. N1570 6.5.6 Additive operators 9 When two pointers are subtracted, both shall point to elements of the same array object, or one past the last element of the array object; the result is the difference of the subscripts of the two array elements. -- pete