- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How should the warning:
src/mosek/mosekopt.c(1893): warning #144: a value of type "char *" cannot be used to initialize an entity of type "char *"
char *pri_par_list[] = {"MSK_IPAR_CONCURRENT_PRIORITY_INTPNT","MSK_IPAR_CONCURRENT_PRIORITY_PRIMAL_SIMPLEX","MSK_IPAR_CONCURRENT_PRIORITY_DUAL_SIMPLEX","MSK_IPAR_CONCURRENT_PRIORITY_FREE_SIMPLEX"};
be understood and how to fix it.
It sort of says char * is not the same as char *-
Erling
PS: It is verion 13 of Intel C at Linux.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
/remote/public/linux/opt/intel/composer_xe_2013.0.079/bin/intel64/icc -o bld/gram/final/default/intelc-13.0.0/dll/mosek-objs/mosekopt.o -c -DSYST\
HREADING=1 -DSYSPTHREAD=1 -DEXTERNPTHREAD -O2 -mp1 -inline-level=2 -DSYSTHREADING=1 -DSYSPTHREAD=1 -DEXTERNPTHREAD -xSSE2 -DBLDTOOL_INTELC -DLINU\
X64X86=1 -D_CPU_GENERIC_ -DSYSOPENMP -w1 -Wp64 -Wcheck -Wmissing-prototypes -diag-disable 913 -Wuninitialized -malign-double -prec_div -gcc-name=\
/remote/public/linux/64-x86/gcc/4.5.2/bin/gcc -gxx-name=/remote/public/linux/64-x86/gcc/4.5.2/bin/g++ -gcc-version=450 -openmp -openmp-link=dynam\
ic -DSYSRESTRICT -restrict -DSYSMT -DMSKCONST= -DSYSRELEASE=0 -DSYSDEBUG=0 -D_MOSEKDEV=0 -DNDEBUG -DCCVERSION=13.0.0 -fPIC -Isrc/basic -Isrc/cpub\
-Isrc/dualize -Isrc/homo -Isrc/kfac -Isrc/lalib -Isrc/lu -Isrc/math -Isrc/misc -Isrc/netopt -Isrc/network -Isrc/optimize -Isrc/order -Isrc/pivot\
-Isrc/prslv -Isrc/simplex -Isrc/temp -Isrc/thread -Isrc/mio/extern -Ibld/gram/final/default/intelc-13.0.0/src/ivec -Isrc/mosek -Ibld/gram/final/\
default/intelc-13.0.0/src/mosek -I/remote/public/linux/64-x86/gcc/4.5.2/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/install-tools/include -I/remote/pu\
blic/linux/64-x86/gcc/4.5.2/lib/gcc/x86_64-unknown-linux-gnu/4.5.2/install-tools/include src/mosek/mosekopt.c
src/mosek/mosekopt.c(1893): warning #144: a value of type "char *" cannot be used to initialize an entity of type "char *"
char *pri_par_list[] = {"MSK_IPAR_CONCURRENT_PRIORITY_INTPNT","MSK_IPAR_CONCURRENT_PRIORITY_PRIMAL_SIMPLEX","MSK_IPAR_CONCURRENT_PRIORITY_DUA\
L_SIMPLEX","MSK_IPAR_CONCURRENT_PRIORITY_FREE_SIMPLEX"};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think the warning is telling you that you shouldn't be trying to initialize a char* with a string literal (which is non writable).
This is the warning the latest icc and gcc would give if you used the -Wwrite-strings option:
sptxl8-510> gcc -Wwrite-strings -c t.c
t.c:2: warning: initialization discards qualifiers from pointer target type
sptxl8-511> icc -Wwrite-strings -c t.c
t.c(2): warning #3179: deprecated conversion of string literal to char* (should be const char*)
char* c[] = { "abc" };
^
sptxl8-512>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It is .c file.
You right I can ignore the warning but it is VERY annoying to get warnings for things that is correct. It devalues the value of warnings.
Btw actually I would like to have
const char *pri_par_list[] = {"MSK_IPAR_CONCURRENT_PRIORITY_INTPNT","MSK_IPAR_CONCURRENT_PRIORITY_PRIMAL_SIMPLEX","MSK_IPAR_CONCURRENT_PRIORITY_DUA\
L_SIMPLEX","MSK_IPAR_CONCURRENT_PRIORITY_FREE_SIMPLEX"};
but that also cause warnings. I think the const is more correct since you cannot change the strings.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page