int() always zero?

me22 me22.ca@gmail.com
Mon Mar 10 23:42:00 GMT 2008


On Mon, Mar 10, 2008 at 7:38 PM, Jason Mancini <jayrusman@hotmail.com> wrote:
>
>  Hi everyone,
>  Is "int()" always zero?
>  bool() is always false?
>  type*() is always NULL?
>  Why, and which spec...
>  Thanks!
>  Jason
>

Research "value initialization" in your standard, iirc, but the answers are

int() ==> 0
unsigned() ==> 0u
bool() ==> false
some_pointer_type() == static_cast<some_pointer_type>(0), which may or
may not be == reinterpret_cast<some_pointer_type>(0)



More information about the Gcc-help mailing list