Re: I met a "strange" thing...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10 December 2014 at 13:03, Graziano Servizi wrote:
> Hi,
>
> by pure chance, during a copy+paste editing operation of a source code,
> I ended up inadvertently with a code line like the following:
>
>                          int * x = int();
>
> Well, this code HAD BEEN COMPILED by g++ 4.8.3, and I cannot figure out its
> meaning (from the compiler's point of view).

int() creates an integer with value zero.

In C++03 any integer expression with value zero is a valid null
pointer value, so you can do any of these:

int* p1 = 0;
int* p2 = '\0';
int* p3 = 1-1;




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux