Re: Why "global" variable can't be processed properly?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Robin.Horde wrote:
> 
> 
>>> I used C in multi platforms many years and never
>> encountered this unspecified
>>
>> It is not unspecified behavior.
>>
>> It is specified as undefined behavior.
>>
>>> I hope GCC can be consistent with the others. Maybe
>> that's a better way.
>>
>> I do not think that is a better way.
>>
>> I think it is better to not rely on the behavior of a
>> particular compiler for language undefined behavior.
>>
>> It would be nice if the compiler could ALWAYS warn about
>> code that has undefined behavior.

I think that's equivalent to the halting problem.

> Right! It is better to not rely on the behavior of a particular
> compiler. My source have not consider the order of evaluation. But
> however, undefined behavior is still a behavior. My mean is better
> to be compatible with most others.

I understand what you mean, but I disagree.  The point of leaving such
behaviour undefined in the language is to allow implementers freedom
to optimize while letting users know what behaviour they can rely on.
There are many places in the standard where behaviour is undefined,
and a professional C programmer needs to know about them all.

Andrew.

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux