warnings with c program compiling :assignment makes pointer from integer without a cast [enabled by default] -


when compiling program named online_ana.c (by running makefile) following line:

if ((fifofile = open((fifo1!=null) ? fifo1 : "fifo1", o_rdonly)) == -1) 

encountered such warnings:

online_ana.c:54:17: warning: assignment makes pointer integer without cast [enabled default]

whats wrong that? hope can me. in advance!!

there's couple things wrong this.

1)you're assigning integer value pointer. isn't wrong, suspicious. means bug, there situations ok. that's why compiler spits out warning rather error. should assure mean it.

2)like @barmar said, open returns integer (a file handle) not file*. if you're assigning 1 other wrong.

3)slightly unrelated, assigning , comparing in if bad idea. easy accidentally type = somewhere meant == , cause bugs. should avoided, use 1 line assignment , 1 comparison. know old school c style use single line, these days considered bad idea.


Comments

Popular posts from this blog

java - How to specify maven bin in eclipse maven plugin? -

single sign on - Logging into Plone site with credentials passed through HTTP -

php - Why does AJAX not process login form? -