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

From Boszormenyi Zoltan
Subject Re: Question about ECPGset_noind_null() and ECPGis_noind_null()
Date
Msg-id 4B05AC4D.6070705@cybertec.at
Whole thread Raw
In response to Re: Question about ECPGset_noind_null() and ECPGis_noind_null()  (Boszormenyi Zoltan <zb@cybertec.at>)
List pgsql-hackers
Boszormenyi Zoltan írta:
> Tom Lane írta:
>   
>> Boszormenyi Zoltan <zb@cybertec.at> writes:
>>   
>>     
>>>         for (; length > 0 && ptr[--length] == 0xff;);
>>>     
>>>       
>>   
>>     
>>> I suspect that GCC does the "--length" after checking
>>> "length > 0" and before checking the "ptr[...] == 0xff",
>>> but HP CC does it before checking "length > 0".
>>>     
>>>       
>> If it does, that is *unquestionably* a bug in HP's CC and should be
>> reported to them.
>>     
>
> 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, i.e. they
> can be freely reordered or placed anywhere in the
> expression, provided that the postfix operator's evaluation
>   
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Above is the prefix case obviously...

> is earlier than the usage of the variable it's used on and
> evaluation is later than the variable usage in the postfix case.
> This means that their usage has to be minimized so the
> result is unambiguous.

-- 
Bible has answers for everything. Proof:
"But let your communication be, Yea, yea; Nay, nay: for whatsoever is more
than these cometh of evil." (Matthew 5:37) - basics of digital technology.
"May your kingdom come" - superficial description of plate tectonics

----------------------------------
Zoltán Böszörményi
Cybertec Schönig & Schönig GmbH
http://www.postgresql.at/



pgsql-hackers by date:

Previous
From: Boszormenyi Zoltan
Date:
Subject: Re: Question about ECPGset_noind_null() and ECPGis_noind_null()
Next
From: Andrew Dunstan
Date:
Subject: Re: Question about ECPGset_noind_null() and ECPGis_noind_null()