chicken-hackers
[Top][All Lists]
Advanced

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

Re: [Chicken-hackers] Pessimizing undefined behavior


From: megane
Subject: Re: [Chicken-hackers] Pessimizing undefined behavior
Date: Thu, 04 Apr 2019 16:01:07 +0300
User-agent: mu4e 1.0; emacs 25.1.1

megane <address@hidden> writes:

> address@hidden writes:
>
>>> >> Based on my limited observations (##core#undefined) will always have
>>> >> the value 30L at runtime. This is not equal to 6L (or #f). Therefore
>>> >> an undefined value in conditional test will always cause the true
>>> >> branch to be chosen.
>>> >
>>> > That's an implementation artefact, (begin) may also return #f, which would
>>> > be legal according to the standard. "Undefined" is not a value nor a type.
>>>
>>> You mean the compiler currently sometimes returns #f for (begin)?
>>
>> No, but it could, depending on some arcane optimization that someone
>> may implement in the future (or not). It's simply open to the implementation.
>>
>
> There's the possiblity of documenting this optimization:
>
> "If the expression's value can be determined statically to be undefined
> the value will be considered truthy. Otherwise the value can be
> anything, including false."

Maybe this is better:

"In conditionals an expression having an undefined value can be
considered either true or false. This may cause the true or false branch
to be dropped."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]