Re: Question about ECPGset_noind_null() and ECPGis_noind_null() - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Question about ECPGset_noind_null() and ECPGis_noind_null()
Date
Msg-id 29461.1258663872@sss.pgh.pa.us
Whole thread Raw
In response to Re: Question about ECPGset_noind_null() and ECPGis_noind_null()  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: Question about ECPGset_noind_null() and ECPGis_noind_null()
List pgsql-hackers
Andrew Dunstan <andrew@dunslane.net> writes:
> Boszormenyi Zoltan wrote:
>> Is it *really* a bug? I recalled a comment from my C teacher
>> in '92 or '93 about this exact issue, that the prefix/postfix
>> increment/decrement operators are executed in the
>> statement in an implementation-defined order, 

> Not if they come after a short-circuit operator such as && - after all, 
> that's what short-circuit evaluation implies. If the left hand operand 
> of && is false the right hand should not be evaluated at all.

Yes.  && is a sequence point and the compiler is not allowed to move
side-effects across a sequence point.  What your C teacher was warning
you against was things likea[i] = i++;
'=' is not a sequence point so it's undefined which array index
will be stored into.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Andrew Dunstan
Date:
Subject: Re: Question about ECPGset_noind_null() and ECPGis_noind_null()
Next
From: Heikki Linnakangas
Date:
Subject: Re: Architecture of walreceiver (Streaming Replication)