GCC 编译报错——suggest parentheses around comparison in operand of

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/frank_jb/article/details/85242686

warning: suggest parentheses around comparison in operand of ‘&’ [-Wparentheses]

该警告希望你在&(逻辑与)表达式左右加上括号。有的时候&&(逻辑且)少写了一个&,也会产生该警告。

 

例如:   if((a[2]>>1)&0x1 == 1){ 

             .........

          }
应该将 (a[2]>>1)&0x1 用()号括起来。因为&运算符的优先级较低,低于==和!=运算符。

展开阅读全文

求助解决sunos5.9 平台gcc编译报错问题

03-27

本来在IBM AIX上跑的程序,现在移植到sunos 5.9 上,用gcc,或者g++编译报的错误,哪位高手帮我看看..手里只有90积分,如果解决了随便哪去,谢谢!声明:源程序肯定是没问题的,只是移植过来可能我一些环境变量,路径配置甚么的没配对...下面是错误报告,没整过sun的平台..所以不是很清楚rn$ make remakernrm -f src/*.orng++ -c -I. -I/orajf/arch/zhcjtest/sunshine/develop/public/include -Iinclude -I/oracle/product/9.2.0/precomp/public -I/oracle/product/9.2.0/rdbms/demo -I/oracle/product/9.2.0/rdbms/public -DLINUX -fPIC -g -O2 -I. -I./include -DNAMESPACE -D_GNU_SOURCE -D_LARGEFILE64_SOURCE=1 -D_LARGEFILE_SOURCE=1 -DSLTS_ENABLE -DSLMXMX_ENABLE -D_REENTRANT -DNS_THREADS -o src/common.o src/common.cpprnsrc/common.cpp: In static member function `static void util::common::round(int, int, double&)':rnsrc/common.cpp:420: error: `::round' has not been declaredrnsrc/common.cpp: At global scope:rnsrc/common.cpp:807: error: no `int util::common::grt_com_div(int, int)' member function declared in class `util::common'rnsrc/common.cpp: In member function `int util::common::grt_com_div(int, int)':rnsrc/common.cpp:818: error: `grt_com_div' was not declared in this scopernsrc/common.cpp: At global scope:rnsrc/common.cpp:824: error: no `int util::common::grt_com_div(std::vector >&)' member function declared in class `util::common'rnsrc/common.cpp: In member function `int util::common::grt_com_div(std::vector >&)':rnsrc/common.cpp:831: error: `grt_com_div' was not declared in this scopernsrc/common.cpp: At global scope:rnsrc/common.cpp:838: error: no `int util::common::ls_com_mul(int, int)' member function declared in class `util::common'rnrn*** Error code 1rnmake: Fatal error: Command failed for target `src/common.o'rnrn用户下的.profile文件设置:rnORACLE_DOC=$ORACLE_HOME/doc; export ORACLE_DOCrnCLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib:$ORACLE_HOME/network/jlibrnLD_LIBARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/network/lib;export LD_LIBARY_PATHrnrnPATH=$PATH:/usr/sbin:/usr/bin:/oracle/product/9.2.0/bin:/usr/ccs/bin:/opt/Studio8/SUNWspro/bin/:.rn export PATH 论坛

Around the world

10-02

DescriptionnnOver the years, FJ has made a huge number of farmer friends all around the world. Since he hasn't visited 'Farmer Ted' from England and 'Boer Harms' from Holland for a while, he'd like to visit them. nnHe knows the longitude of the farm where each of his worldwide friends resides. This longitude is an angle (an integer in the range 0..359) describing the farm's location on the Earth, which we will consider to be a circle instead of the more complex and traditional spherical representation. Except for the obvious discontinuity, longitudes increase when traveling clockwise on this circle. nnFJ plans to travel by airplane to visit his N (1 <= N <= 5,000) friends (whose farms are uniquely numbered 1..N). He knows the schedules for M (1 <= M <= 25,000) bidirectional flights connecting the different farms. Airplanes always travel shortest paths on the Earth's surface (i.e., on the shortest arc of a circle). nnThere will always be a unique shortest path between two farms that are directly connected. No pair of antipodal farms (exactly opposite each other on the circle) is ever directly connected. nnEach airplane flight can be described as traveling in clockwise or counterclockwise direction around the Earth's surface. For example, a flight from longitude 30 to longitude 35 would be clockwise, as would be a flight from longitude 350 to longitude 10. However, a flight from longitude 350 to longitude 200 follows a shortest path counterclockwise around the circle. nnFJ would find it very cool if he could make a trip around the world, visiting some of his friends along the way. He'd like to know if this is possible and if so, what is the minimum number of flights he can take to do so. nnHe wants to start and finish his journey at the location of his best friend (the one listed first in the input below). In order to make sure he actually circles the Earth, he wants to ensure that the clockwise distance he travels is different from the counterclockwise distance he travels.nInputnn* Line 1: Two space-separated integers: N and M nn* Lines 2..N+1: Line i+1 contains one integer: the longitude of the i-th farm. Line 2 contains the location of the farm of his best friend. nn* Lines N+2..N+M+1: Line i+N+1 contains two integers giving the indices of two farms that are connected by a flight. nOutputnn* Line 1: A single integer specifying the minimum number of flights FJ needs to visit to make a trip around the world. Every time FJ moves from one farm to another counts as one flight. If it is impossible to make such a trip, output the integer -1. nSample Inputnn3 3n0n120n240n1 2n2 3n1 3nSample Outputnn3 问答

没有更多推荐了,返回首页