[haiku-development] Re: src_build_libbe_storage_Volume.cpp.diff
- From: Michael Pfeiffer <michael.w.pfeiffer@xxxxxxxxx>
- To: haiku-development@xxxxxxxxxxxxx
- Date: Fri, 30 May 2008 07:02:20 +0200
Am 30.05.2008 um 00:50 schrieb kaoutsis:
Hi there,
Tried to fix this warning:
src/build/libbe/storage/Volume.cpp: In member function ‘bool
BVolume::operator==(const BVolume&) const’:
src/build/libbe/storage/Volume.cpp:180: warning: suggest parentheses
around && within ||
good bye,
Vasilis
Index: src/build/libbe/storage/Volume.cpp
===================================================================
--- src/build/libbe/storage/Volume.cpp (revision 25715)
+++ src/build/libbe/storage/Volume.cpp (working copy)
@@ -176,8 +176,8 @@
bool
BVolume::operator==(const BVolume &volume) const
{
- return (InitCheck() != B_OK && volume.InitCheck() != B_OK
- || fDevice == volume.fDevice);
+ return (InitCheck() != B_OK && volume.InitCheck() != B_OK)
+ || (fDevice == volume.fDevice);
}
// !=
Since when did we let the compiler dictate our coding style? :-)
I suggest to turn off this kind of warnings.
BTW the return expression should not be between parentheses:
return InitCheck() != B_OK && volume.InitCheck() != B_OK
|| fDevice == volume.fDevice;
and the expression seems to be wrong too, shouldn't it be:
return InitCheck() == B_OK && volume.InitCheck() == B_OK
&& fDevice == volume.fDevice;
Regards,
Michael
- Follow-Ups:
- [haiku-development] Re: src_build_libbe_storage_Volume.cpp.diff
- From: Stephan Assmus
- [haiku-development] Re: src_build_libbe_storage_Volume.cpp.diff
- From: Axel Dörfler
- References:
Other related posts:
- » [haiku-development] src_build_libbe_storage_Volume.cpp.diff
- » [haiku-development] Re: src_build_libbe_storage_Volume.cpp.diff
- » [haiku-development] Re: src_build_libbe_storage_Volume.cpp.diff
- » [haiku-development] Re: src_build_libbe_storage_Volume.cpp.diff
- » [haiku-development] Re: src_build_libbe_storage_Volume.cpp.diff
- » [haiku-development] src_build_libbe_storage_Volume.cpp.diff
Hi there, Tried to fix this warning:src/build/libbe/storage/Volume.cpp: In member function ‘bool BVolume::operator==(const BVolume&) const’: src/build/libbe/storage/Volume.cpp:180: warning: suggest parentheses around && within ||
good bye,
Vasilis
Index: src/build/libbe/storage/Volume.cpp
===================================================================
--- src/build/libbe/storage/Volume.cpp (revision 25715)
+++ src/build/libbe/storage/Volume.cpp (working copy)
@@ -176,8 +176,8 @@
bool
BVolume::operator==(const BVolume &volume) const
{
- return (InitCheck() != B_OK && volume.InitCheck() != B_OK
- || fDevice == volume.fDevice);
+ return (InitCheck() != B_OK && volume.InitCheck() != B_OK)
+ || (fDevice == volume.fDevice);
}
// !=
- [haiku-development] Re: src_build_libbe_storage_Volume.cpp.diff
- From: Stephan Assmus
- [haiku-development] Re: src_build_libbe_storage_Volume.cpp.diff
- From: Axel Dörfler