Re: [vbox-dev] [PATCH 2/8] Fix an implicit conversion from pointer to bool

2015-03-26 Thread Jung-uk Kim
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 03/26/2015 15:25, Michal Necasek wrote: > Sorry, I wasn't clear. By "what is the semantic difference" I meant > "under what circumstances will the conditional behave differently". > There must be some difference because otherwise what would be the

Re: [vbox-dev] [PATCH 2/8] Fix an implicit conversion from pointer to bool

2015-03-26 Thread Michal Necasek
Sorry, I wasn't clear. By "what is the semantic difference" I meant "under what circumstances will the conditional behave differently". There must be some difference because otherwise what would be the point of a warning? Remember that programmers can have a hard time reading compilers' minds

Re: [vbox-dev] [PATCH 1/8] Fix misused Assert*() macros

2015-03-26 Thread Jung-uk Kim
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 03/26/2015 05:08, Frank Mehnert wrote: > Hi, > > On Friday 13 March 2015 16:56:47 Jung-uk Kim wrote: >> include/VBox/com/array.h - fixes for null-pointer dereferences. > > that's difficult. I know that compilers and static code checking > tools

Re: [vbox-dev] [PATCH 2/8] Fix an implicit conversion from pointer to bool

2015-03-26 Thread Jung-uk Kim
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 03/26/2015 14:03, Michal Necasek wrote: > > The question isn't whether a compiler can warn. The question is, > why should it? Although this specific code has absolutely no problem, compilers are not smart enough to read authors' mind yet. ;-) >

Re: [vbox-dev] [PATCH 2/8] Fix an implicit conversion from pointer to bool

2015-03-26 Thread Michal Necasek
The question isn't whether a compiler can warn. The question is, why should it? What you quoted doesn't contradict what Frank said. There is a very well defined pointer to bool conversion. So what's the problem? Or in other words, what is the semantic difference between if (ptr) and

Re: [vbox-dev] [PATCH 2/8] Fix an implicit conversion from pointer to bool

2015-03-26 Thread Jung-uk Kim
-BEGIN PGP SIGNED MESSAGE- Hash: SHA256 On 03/26/2015 04:51, Frank Mehnert wrote: > Hi, > > On Friday 13 March 2015 16:56:56 Jung-uk Kim wrote: >> This fix an implicit conversion from pointer to bool. > > why is this patch necessary? An expression like > > if (pointer) { } > > is compl

Re: [vbox-dev] [PATCH 4/8] Properly use sysctlbyname(3) for FreeBSD

2015-03-26 Thread Frank Mehnert
Hi, On Friday 13 March 2015 16:57:21 Jung-uk Kim wrote: > sysctlbyname(3) for FreeBSD requires size_t type for the last > argument, not a pointer. > > https://www.freebsd.org/cgi/man.cgi?query=sysctlbyname&format=html Applied. Thanks for the patch and the pointer to the documentation! Frank --

Re: [vbox-dev] [PATCH 1/8] Fix misused Assert*() macros

2015-03-26 Thread Frank Mehnert
Hi, On Friday 13 March 2015 16:56:47 Jung-uk Kim wrote: > include/VBox/com/array.h > - fixes for null-pointer dereferences. that's difficult. I know that compilers and static code checking tools complain but the intention behind these statements is to return NULL in case we are trying to access a

Re: [vbox-dev] [PATCH 2/8] Fix an implicit conversion from pointer to bool

2015-03-26 Thread Frank Mehnert
Hi, On Friday 13 March 2015 16:56:56 Jung-uk Kim wrote: > This fix an implicit conversion from pointer to bool. why is this patch necessary? An expression like if (pointer) { } is completely valid and no compiler should warn about it. It tests if the pointer has a value different from NUL

Re: [vbox-dev] [PATCH 5/8] Use proper operators

2015-03-26 Thread Frank Mehnert
On Friday 13 March 2015 16:57:28 Jung-uk Kim wrote: > This simply fixes typos, i.e., '||' was misused in place of '<<'. Applied. Actually not a bug but the fix still makes sense. Thanks! Frank -- Dr.-Ing. Frank Mehnert | Software Development Director, VirtualBox ORACLE Deutschland B.V. & Co. KG

Re: [vbox-dev] [PATCH 7/8] Shut up a warning for dangling else

2015-03-26 Thread Frank Mehnert
On Friday 13 March 2015 16:58:02 Jung-uk Kim wrote: > Although it is not really a bug, Clang complains there may be a problem. Applied. Thanks! Frank -- Dr.-Ing. Frank Mehnert | Software Development Director, VirtualBox ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weinstadt, Germany

Re: [vbox-dev] [PATCH 8/8] Add missing returns for CPUIDs

2015-03-26 Thread Frank Mehnert
Hi, On Friday 13 March 2015 16:58:12 Jung-uk Kim wrote: > This switch/case statement for AMD K7 processors does not return > correct CPUIDs. applied. Thanks! Frank -- Dr.-Ing. Frank Mehnert | Software Development Director, VirtualBox ORACLE Deutschland B.V. & Co. KG | Werkstr. 24 | 71384 Weins