[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::decc

Title:DECC
Notice:General DEC C discussions
Moderator:TLE::D_SMITHNTE
Created:Fri Nov 13 1992
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:2212
Total number of notes:11045

2160.0. "postfix a[i++] = i; legal?" by CHEFS::DAVIDSONS () Wed Apr 23 1997 16:31

    Will the following always be evaluated in the same order
    so that it produces the same result on any platform?
    
    a[i++] = i;
    
    Thanks,
    	Stuart.
T.RTitleUserPersonal
Name
DateLines
2160.1SPECXN::DERAMODan D'EramoWed Apr 23 1997 16:403
        No.  Its behavior is undefined.
        
        Dan
2160.2We will warn on such casesDECC::VOGELWed Apr 23 1997 16:4313
    
    Note that V5.6 of DEC C will issue the following warning for this case:
    
        a[i++] = i;
    ....^
    %CC-W-UNDEFVARFETCH, In this statement, the expression "a[i++]=i" modifies 
    "i", and fetches its value in a computation that is not used to produce the
    modified value without an intervening sequence point.  This behavior is
    undefined.
    
    						Ed
    
    
2160.3ThanksCHEFS::DAVIDSONSWed Apr 23 1997 16:551