How do I get Intel 16 to generate warnings if I mix enum types.
# Begin
c:\Users\eda\mosekdbg>icl testenum.c
Intel(R) C++ Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 16.0.2.180 Build 20160204
Copyright (C) 1985-2016 Intel Corporation. All rights reserved.
testenum.c
Microsoft (R) Incremental Linker Version 11.00.50727.1
Copyright (C) Microsoft Corporation. All rights reserved.
-out:testenum.exe
testenum.obj
# End
clang says
eda@karise:~/mosekprj/dev$ clang-3.6 ~/testenum.c -o testenum
/home/eda/testenum.c:27:11: warning: implicit conversion from enumeration type 'anotherenum' to different enumeration type
'someenum' [-Wenum-conversion]
myfunc(mid);
~~~~~~ ^~~
1 warning generated.
eda@karise:~/mosekprj/dev$
And that is what I want. Can Intel C do that?
Here is the code I compile.
#include <stdio.h>
typedef enum
{
lower = 0,
upper = 1
} someenum;
typedef enum
{
mid = 8
} anotherenum;
void myfunc(someenum e)
{
printf("enum test %d\n",(int) e);
if ( e>=lower )
printf("e>=lower\n");
else
printf("e<lower\n");
}
int main()
{
myfunc(mid);
}