On 11/20/2026 3:24 PM, Arne Vajhøj wrote:
> On 11/20/2026 3:10 PM, Simon Clubley wrote:
>> On 2026-11-20, Arne Vajhøj <ar…@vajhoej.dk> wrote:
>>> And for the curious - before fix:
>>>
>>> use_ssl = resource->scheme && (ZSTR_LEN(resource->scheme) > 4) &&
>>> ZSTR_VAL(resource->scheme)[4] == 's';
>>
>> I really hope that line was always compiled by a short-circuiting
>> compiler and that line always successfully triggered short-circuiting...
>>
>> Don't be surprised if everyone is now looking for similar constructs
>> that rely on short-circuiting to be safe.
>
> Doesn't C require/mandate short circuiting in cases like this??
I believe the VMS landscape looks like:
Undefined(*) L to R L to R
all short circuit
VMS Fortran .and.
.or.
VMS Pascal and and_then
or or_else
C & &&
| ||
Ada and and then
or or else
Java & &&
| ||
Python & and
| or
PHP & &&
| ||
and(**)
or(**)
*) do not use with anything with side effects
**) do not use ever
Example of undefined with VMS Pascal and /OPT vs /NOOPT:
$ type demo.pas
program demo(input,output);
function ff : boolean;
begin
writeln('ff');
ff := false;
end;
function tf : boolean;
begin
writeln('tf');
tf := true;
end;
var
res : boolean;
begin
res := ff and tf;
writeln('ff and tf', res);
res := ff and_then tf;
writeln('ff and_then tf', res);
res := tf or ff;
writeln('tf or ff', res);
res := tf or_else ff;
writeln('tf or_else ff', res);
end.
$ pas demo
$ lin demo
$ r demo
ff
ff and tf FALSE
ff
ff and_then tf FALSE
tf
tf or ff TRUE
tf
tf or_else ff TRUE
$ pas/noop demo
$ lin demo
$ r demo
ff
tf
ff and tf FALSE
ff
ff and_then tf FALSE
tf
ff
tf or ff TRUE
tf
tf or_else ff TRUE
Arne