On Fri, 2020-07-17 at 16:53 +0200, Domingo Alvarez Duarte wrote:
Hello !
When compiling with CLANG10 we get this warning:
=====
clang -DHAVE_CONFIG_H -I. -I.. -I. -I./amd -I./api -I./bflib
-I./colamd -I./draft -I./env -I./intopt -I./minisat -I./misc -I./mpl
-I./npp -I./proxy -I./simplex -I./zlib -g -O3 -march=native -DNEBUG
-DWITH_SPLAYTREE -flto
-I/home/mingo/local/clang-10/lib/clang/10.0.0/include
-I/home/mingo/local/clang-10/include -I/home/mingo/local/include -MT
libglpk_la-spxprim.lo -MD -MP -MF .deps/libglpk_la-spxprim.Tpo -c
simplex/spxprim.c -fPIC -DPIC -o .libs/libglpk_la-spxprim.o
simplex/spxprim.c:1526:7: warning: add explicit braces to avoid
dangling
else [-Wdangling-else]
else
^
1 warning generated.
This is a well-known syntactic problem dated back to Algol 60.
The statement:
if A then if B then C else D
can be interpreted in two ways:
if A then (if B then C) else D
if A then (if B then C else D)
However, this disambiguation doesn't appear in C due to its more
perfect grammar.