Re: No pointer conversion warning for "bool" in C/C++

2011-09-26 Thread Jon Grant
Jonathan Wakely wrote, On 26/09/11 09:53: On 26 September 2011 09:32, Jon Grant wrote: [.] bool invalid = (NULL == p); Why is that preferable? It would be clearer IMHO what was happening. I expect this depends on what the standard allows then. 4.12 Boolean conversions [conv.bool] 1

Re: No pointer conversion warning for "bool" in C/C++

2011-09-26 Thread Jonathan Wakely
On 26 September 2011 09:32, Jon Grant wrote: > Hello > > Jonathan Wakely wrote, On 26/09/11 08:10: >> >> On 26 September 2011 05:29, Ian Lance Taylor wrote: >>> >>> Jon Grant  writes: >>> Currently gcc, and g++ don't give a warning when a pointer was converted to a bool, in the same way i

Re: No pointer conversion warning for "bool" in C/C++

2011-09-26 Thread Jon Grant
Hello Jonathan Wakely wrote, On 26/09/11 08:10: On 26 September 2011 05:29, Ian Lance Taylor wrote: Jon Grant writes: Currently gcc, and g++ don't give a warning when a pointer was converted to a bool, in the same way it is for other types. At least in C++, it's not really true to say "in

Re: No pointer conversion warning for "bool" in C/C++

2011-09-26 Thread Jonathan Wakely
On 26 September 2011 05:29, Ian Lance Taylor wrote: > Jon Grant writes: > >> Currently gcc, and g++ don't give a warning when a pointer was >> converted to a bool, in the same way it is for other types. At least in C++, it's not really true to say "in the same way it is for other types" because y

Re: No pointer conversion warning for "bool" in C/C++

2011-09-25 Thread Ian Lance Taylor
Jon Grant writes: > Currently gcc, and g++ don't give a warning when a pointer was > converted to a bool, in the same way it is for other types. There is a lot of code which uses if (p) where p is a pointer to test whether p is not NULL. I don't think we could reasonably have gcc warn about

No pointer conversion warning for "bool" in C/C++

2011-09-25 Thread Jon Grant
Hello Currently gcc, and g++ don't give a warning when a pointer was converted to a bool, in the same way it is for other types. Could I ask for opinion on this, and if I should create a bug ticket. Please find below output from compilation, and attachments showing the two tests. gcc (Ubun