Boost logo

Boost :

Subject: Re: [boost] [new Warnings policy] MS C4180 on the MaintenanceGuidelines
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-11-18 10:05:21


Gottlob Frege wrote:
> On Tue, Nov 17, 2009 at 7:35 PM, Mateusz Loskot <mateusz_at_[hidden]> wrote:
>> Emil Dotchevski wrote:
>>> Assuming ptr is a pointer, AFAIK assert(ptr) is illegal, though
>>> assert(ptr!=0) and assert(!ptr) are OK.
>> Yes, that's right. In this case some suggest to use
>> assert(!!ptr) what I do not really consider personally
>> as readable, prefering assert(0 != ptr);
> Can someone explain how assert(ptr) is illegal? I haven't heard that before.
> Is if (ptr) illegal now too?

I don't think so. I don't have a copy of the current C standard handy,
but n1336 (which is the current draft) says:

"Arithmetic types and pointer types are collectively called scalar
types. Array and
structure types are collectively called aggregate types.39)"

"#include <assert.h>
void assert(scalar expression);"

In Christ,
Steven Watanabe

Boost list run by bdawes at, gregod at, cpdaniel at, john at