| delorie.com/archives/browse.cgi | search |
| Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
| List-Subscribe: | <mailto:cygwin-subscribe AT sources DOT redhat DOT com> |
| List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT sources DOT redhat DOT com> |
| List-Help: | <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs> |
| Sender: | cygwin-owner AT sources DOT redhat DOT com |
| Delivered-To: | mailing list cygwin AT sources DOT redhat DOT com |
| X-Originating-IP: | [212.54.79.234] |
| From: | "Jonas Jensen" <bones0_list AT hotmail DOT com> |
| To: | "Brian J Ball" <bjball AT sep DOT com>, <cygwin AT sourceware DOT cygnus DOT com> |
| References: | <NEBBINHAMKDDGPELHGEPAEBNCAAA DOT bjball AT sep DOT com> |
| Subject: | Re: Post incrementers in arrays as function arguments |
| Date: | Fri, 18 Aug 2000 20:14:01 +0200 |
| MIME-Version: | 1.0 |
| X-Priority: | 3 |
| X-MSMail-Priority: | Normal |
| X-Mailer: | Microsoft Outlook Express 5.50.4133.2400 |
| X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4133.2400 |
| Message-ID: | <OE30vpvDtDJd5IghQYY00000a5d@hotmail.com> |
| X-OriginalArrivalTime: | 18 Aug 2000 22:06:10.0502 (UTC) FILETIME=[8426CE60:01C00960] |
> This code has produced 3 different results on 4 systems.
> The second result was on the Cygwin B20 system
> [snip]
> /* This use of var++ in a function call is
> unpredictable */
> print_array(array[i++],array[i++],array[i++]);
> }
> [snip]
> However, this works on some platforms and could become an error in porting
> software.
This is semi-documented behavior. Check out the infopage for gcc, this is
from the section "non-bugs":
>>>>>>>>>>>>>>>>>>>>>>>>>
* Making side effects happen in the same order as in some other
compiler.
It is never safe to depend on the order of evaluation of side
effects. For example, a function call like this may very well
behave differently from one compiler to another:
void func (int, int);
int i = 2;
func (i++, i++);
There is no guarantee (in either the C or the C++ standard language
definitions) that the increments will be evaluated in any
particular order. Either increment might happen first. `func'
might get the arguments `2, 3', or it might get `3, 2', or even
`2, 2'.
<<<<<<<<<<<<<<<<<<<<<<<<<
--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |