LangProc / langproc-2017-cw

1 stars 4 forks source link

Logic Operators short circuiting #18

Open ghost opened 6 years ago

ghost commented 6 years ago

Do we need to worry about the short circuiting in C, as it can lead to edge cases in our evaluation. But its part of the spec. but also doesnt it count as a type of optimization? Shall we consider this when creating our compilers?

fyquah commented 6 years ago

I am not sure what is in the assessment, but I assume you do. The following style of code, for eg, is fairly common in programs.

bool
first_element_greater_than_1(int *a, int len)
{
   return len > 0 && a[0] > 0;
}